Ignore MOD field for control/debug register move

This patch ignores the MOD field in control/debug register move
instructions.

gas/testsuite/

	* gas/i386/cdr.d: New file.
	* gas/i386/cdr.s: Likewise.
	* gas/i386/x86-64-cdr.d: Likewise.

	* gas/i386/i386.exp: Run cdr and x86-64-cdr.

opcodes/

	* i386-dis.c (MOD_0F20): Removed.
	(MOD_0F21): Likewise.
	(MOD_0F22): Likewise.
	(MOD_0F23): Likewise.
	(dis386_twobyte): Replace MOD_0F20, MOD_0F21, MOD_0F22 and
	MOD_0F23 with "movZ".
	(mod_table): Remove MOD_0F20, MOD_0F21, MOD_0F22 and MOD_0F23.
	(OP_R): Check mod/rm byte and call OP_E_register.
This commit is contained in:
H.J. Lu 2014-09-22 09:38:53 -07:00
parent 20b23ee6c8
commit 68f3446482
7 changed files with 70 additions and 32 deletions

View file

@ -1,3 +1,11 @@
2014-09-22 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/cdr.d: New file.
* gas/i386/cdr.s: Likewise.
* gas/i386/x86-64-cdr.d: Likewise.
* gas/i386/i386.exp: Run cdr and x86-64-cdr.
2014-09-16 Ilya Tocar <ilya.tocar@intel.com>
* gas/i386/avx512dq-rcig.s: New.

View file

@ -0,0 +1,13 @@
#objdump: -dw
#name: i386 control/debug register with ignored MOD field
.*: +file format .*
Disassembly of section .text:
0+ <start>:
[ ]*[a-f0-9]+: 0f 22 1f mov %edi,%cr3
[ ]*[a-f0-9]+: 0f 20 1f mov %cr3,%edi
[ ]*[a-f0-9]+: 0f 21 1f mov %db3,%edi
[ ]*[a-f0-9]+: 0f 23 1f mov %edi,%db3
#pass

View file

@ -0,0 +1,14 @@
.text
start:
.byte 0x0f
.byte 0x22
.byte 0x1f
.byte 0x0f
.byte 0x20
.byte 0x1f
.byte 0x0f
.byte 0x21
.byte 0x1f
.byte 0x0f
.byte 0x23
.byte 0x1f

View file

@ -80,6 +80,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_dump_test "padlock"
run_dump_test "crx"
run_list_test "cr-err" ""
run_dump_test "cdr"
run_dump_test "svme"
run_dump_test "amdfam10"
run_dump_test "ssse3"
@ -449,6 +450,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
run_dump_test "x86-64-crx-suffix"
run_dump_test "x86-64-drx"
run_dump_test "x86-64-drx-suffix"
run_dump_test "x86-64-cdr"
run_dump_test "x86-64-ssse3"
run_dump_test "x86-64-rep"
run_dump_test "x86-64-rep-suffix"

View file

@ -0,0 +1,14 @@
#objdump: -dw
#name: x86-64 control/debug register with ignored MOD field
#source: cdr.s
.*: +file format .*
Disassembly of section .text:
0+ <start>:
[ ]*[a-f0-9]+: 0f 22 1f mov %rdi,%cr3
[ ]*[a-f0-9]+: 0f 20 1f mov %cr3,%rdi
[ ]*[a-f0-9]+: 0f 21 1f mov %db3,%rdi
[ ]*[a-f0-9]+: 0f 23 1f mov %rdi,%db3
#pass

View file

@ -1,3 +1,14 @@
2014-09-22 H.J. Lu <hongjiu.lu@intel.com>
* i386-dis.c (MOD_0F20): Removed.
(MOD_0F21): Likewise.
(MOD_0F22): Likewise.
(MOD_0F23): Likewise.
(dis386_twobyte): Replace MOD_0F20, MOD_0F21, MOD_0F22 and
MOD_0F23 with "movZ".
(mod_table): Remove MOD_0F20, MOD_0F21, MOD_0F22 and MOD_0F23.
(OP_R): Check mod/rm byte and call OP_E_register.
2014-09-16 Kuan-Lin Chen <kuanlinchentw@gmail.com>
* nds32-asm.c (nds32_opcodes, operand_fields, keyword_im5_i,

View file

@ -753,10 +753,6 @@ enum
MOD_0F1A_PREFIX_0,
MOD_0F1B_PREFIX_0,
MOD_0F1B_PREFIX_1,
MOD_0F20,
MOD_0F21,
MOD_0F22,
MOD_0F23,
MOD_0F24,
MOD_0F26,
MOD_0F2B_PREFIX_0,
@ -2736,10 +2732,10 @@ static const struct dis386 dis386_twobyte[] = {
{ "nopQ", { Ev } },
{ "nopQ", { Ev } },
/* 20 */
{ MOD_TABLE (MOD_0F20) },
{ MOD_TABLE (MOD_0F21) },
{ MOD_TABLE (MOD_0F22) },
{ MOD_TABLE (MOD_0F23) },
{ "movZ", { Rm, Cm } },
{ "movZ", { Rm, Dm } },
{ "movZ", { Cm, Rm } },
{ "movZ", { Dm, Rm } },
{ MOD_TABLE (MOD_0F24) },
{ Bad_Opcode },
{ MOD_TABLE (MOD_0F26) },
@ -11641,26 +11637,6 @@ static const struct dis386 mod_table[][2] = {
{ "bndmk", { Gbnd, Ev_bnd } },
{ "nopQ", { Ev } },
},
{
/* MOD_0F20 */
{ Bad_Opcode },
{ "movZ", { Rm, Cm } },
},
{
/* MOD_0F21 */
{ Bad_Opcode },
{ "movZ", { Rm, Dm } },
},
{
/* MOD_0F22 */
{ Bad_Opcode },
{ "movZ", { Cm, Rm } },
},
{
/* MOD_0F23 */
{ Bad_Opcode },
{ "movZ", { Dm, Rm } },
},
{
/* MOD_0F24 */
{ Bad_Opcode },
@ -15892,10 +15868,10 @@ OP_T (int dummy ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
static void
OP_R (int bytemode, int sizeflag)
{
if (modrm.mod == 3)
OP_E (bytemode, sizeflag);
else
BadOp ();
/* Skip mod/rm byte. */
MODRM_CHECK;
codep++;
OP_E_register (bytemode, sizeflag);
}
static void