diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2015-02-12 14:06:57 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-02-18 15:01:59 -0500 |
commit | cbb53b9623a70f012e1fdfb6fc0af6878df4762b (patch) | |
tree | c7cdaefe10cb242f20ee4c02da6bc36188740ca8 /arch/x86/lib | |
parent | 8a764a875fe3cf3a83296bacd00bfc41917e95e2 (diff) |
x86/asm/decoder: Explain CALLW discrepancy between Intel and AMD
In 64-bit mode, AMD and Intel CPUs treat 0x66 prefix before
branch insns differently. For near branches, it affects decode
too since immediate offset's width is different.
See these empirical tests:
http://marc.info/?l=linux-kernel&m=139714939728946&w=2
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Link: http://lkml.kernel.org/r/1423768017-31766-1-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/x86-opcode-map.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt index 1a2be7c6895d..816488c0b97e 100644 --- a/arch/x86/lib/x86-opcode-map.txt +++ b/arch/x86/lib/x86-opcode-map.txt | |||
@@ -273,6 +273,9 @@ dd: ESC | |||
273 | de: ESC | 273 | de: ESC |
274 | df: ESC | 274 | df: ESC |
275 | # 0xe0 - 0xef | 275 | # 0xe0 - 0xef |
276 | # Note: "forced64" is Intel CPU behavior: they ignore 0x66 prefix | ||
277 | # in 64-bit mode. AMD CPUs accept 0x66 prefix, it causes RIP truncation | ||
278 | # to 16 bits. In 32-bit mode, 0x66 is accepted by both Intel and AMD. | ||
276 | e0: LOOPNE/LOOPNZ Jb (f64) | 279 | e0: LOOPNE/LOOPNZ Jb (f64) |
277 | e1: LOOPE/LOOPZ Jb (f64) | 280 | e1: LOOPE/LOOPZ Jb (f64) |
278 | e2: LOOP Jb (f64) | 281 | e2: LOOP Jb (f64) |
@@ -281,6 +284,10 @@ e4: IN AL,Ib | |||
281 | e5: IN eAX,Ib | 284 | e5: IN eAX,Ib |
282 | e6: OUT Ib,AL | 285 | e6: OUT Ib,AL |
283 | e7: OUT Ib,eAX | 286 | e7: OUT Ib,eAX |
287 | # With 0x66 prefix in 64-bit mode, for AMD CPUs immediate offset | ||
288 | # in "near" jumps and calls is 16-bit. For CALL, | ||
289 | # push of return address is 16-bit wide, RSP is decremented by 2 | ||
290 | # but is not truncated to 16 bits, unlike RIP. | ||
284 | e8: CALL Jz (f64) | 291 | e8: CALL Jz (f64) |
285 | e9: JMP-near Jz (f64) | 292 | e9: JMP-near Jz (f64) |
286 | ea: JMP-far Ap (i64) | 293 | ea: JMP-far Ap (i64) |
@@ -456,6 +463,7 @@ AVXcode: 1 | |||
456 | 7e: movd/q Ey,Pd | vmovd/q Ey,Vy (66),(v1) | vmovq Vq,Wq (F3),(v1) | 463 | 7e: movd/q Ey,Pd | vmovd/q Ey,Vy (66),(v1) | vmovq Vq,Wq (F3),(v1) |
457 | 7f: movq Qq,Pq | vmovdqa Wx,Vx (66) | vmovdqu Wx,Vx (F3) | 464 | 7f: movq Qq,Pq | vmovdqa Wx,Vx (66) | vmovdqu Wx,Vx (F3) |
458 | # 0x0f 0x80-0x8f | 465 | # 0x0f 0x80-0x8f |
466 | # Note: "forced64" is Intel CPU behavior (see comment about CALL insn). | ||
459 | 80: JO Jz (f64) | 467 | 80: JO Jz (f64) |
460 | 81: JNO Jz (f64) | 468 | 81: JNO Jz (f64) |
461 | 82: JB/JC/JNAE Jz (f64) | 469 | 82: JB/JC/JNAE Jz (f64) |
@@ -842,6 +850,7 @@ EndTable | |||
842 | GrpTable: Grp5 | 850 | GrpTable: Grp5 |
843 | 0: INC Ev | 851 | 0: INC Ev |
844 | 1: DEC Ev | 852 | 1: DEC Ev |
853 | # Note: "forced64" is Intel CPU behavior (see comment about CALL insn). | ||
845 | 2: CALLN Ev (f64) | 854 | 2: CALLN Ev (f64) |
846 | 3: CALLF Ep | 855 | 3: CALLF Ep |
847 | 4: JMPN Ev (f64) | 856 | 4: JMPN Ev (f64) |