aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2012-10-24 21:41:33 +0000
committerRoland McGrath <roland@gnu.org>2012-10-24 21:41:33 +0000
commit6c067bbb1a524e90304c4e6c79a9f28bbe5c58e9 (patch)
tree4ac6250d482ea4ffb557466a53a3883cdc1966cf
parent64f401629ba3680d49952c5e96ff88cd4103a156 (diff)
downloadgdb-6c067bbb1a524e90304c4e6c79a9f28bbe5c58e9.zip
gdb-6c067bbb1a524e90304c4e6c79a9f28bbe5c58e9.tar.gz
gdb-6c067bbb1a524e90304c4e6c79a9f28bbe5c58e9.tar.bz2
gas/testsuite/
* gas/i386/rex.s: Add test of REX prefix before fsave (i.e. fwait). * gas/i386/rex.d: Update. opcodes/ * i386-dis.c (ckprefix): When bailing out for fwait with prefixes, set rex_used to rex.
-rw-r--r--gas/testsuite/ChangeLog5
-rw-r--r--gas/testsuite/gas/i386/ilp32/rex.d3
-rw-r--r--gas/testsuite/gas/i386/rex.d3
-rw-r--r--gas/testsuite/gas/i386/rex.s3
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/i386-dis.c119
6 files changed, 80 insertions, 58 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index b0aa64c..f92b1f5 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-24 Roland McGrath <mcgrathr@google.com>
+
+ * gas/i386/rex.s: Add test of REX prefix before fsave (i.e. fwait).
+ * gas/i386/rex.d: Update.
+
2012-10-22 Peter Bergner <bergner@vnet.ibm.com>
* gas/ppc/altivec.s <vcfpsxws>: Fix opcode spelling.
diff --git a/gas/testsuite/gas/i386/ilp32/rex.d b/gas/testsuite/gas/i386/ilp32/rex.d
index 50eb22c..7c704c9 100644
--- a/gas/testsuite/gas/i386/ilp32/rex.d
+++ b/gas/testsuite/gas/i386/ilp32/rex.d
@@ -15,6 +15,9 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+4a 0f ae 04 05 00 00 00 00[ ]+fxsave64[ ]+(0x0)?\(,%r8(,1)?\)
[ ]*[0-9a-f]+:[ ]+43 0f ae 04 00[ ]+fxsave[ ]+\(%r8,%r8(,1)?\)
[ ]*[0-9a-f]+:[ ]+4b 0f ae 04 00[ ]+fxsave64[ ]+\(%r8,%r8(,1)?\)
+[ ]*[0-9a-f]+:[ ]+41\s+rex\.B
+[ ]*[0-9a-f]+:[ ]+9b dd 30\s+fsave\s+\(%rax\)
+[ ]*[0-9a-f]+:[ ]+9b 41 dd 30\s+fsave\s+\(%r8\)
[ ]*[0-9a-f]+:[ ]+40 c5 f9 28 00[ ]+rex vmovapd \(%rax\),%xmm0
[ ]*[0-9a-f]+:[ ]+40[ ]+rex
[ ]*[0-9a-f]+:[ ]+41[ ]+rex.B
diff --git a/gas/testsuite/gas/i386/rex.d b/gas/testsuite/gas/i386/rex.d
index 3548ff2..bf783c6 100644
--- a/gas/testsuite/gas/i386/rex.d
+++ b/gas/testsuite/gas/i386/rex.d
@@ -14,6 +14,9 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+4a 0f ae 04 05 00 00 00 00[ ]+fxsave64[ ]+(0x0)?\(,%r8(,1)?\)
[ ]*[0-9a-f]+:[ ]+43 0f ae 04 00[ ]+fxsave[ ]+\(%r8,%r8(,1)?\)
[ ]*[0-9a-f]+:[ ]+4b 0f ae 04 00[ ]+fxsave64[ ]+\(%r8,%r8(,1)?\)
+[ ]*[0-9a-f]+:[ ]+41\s+rex\.B
+[ ]*[0-9a-f]+:[ ]+9b dd 30\s+fsave\s+\(%rax\)
+[ ]*[0-9a-f]+:[ ]+9b 41 dd 30\s+fsave\s+\(%r8\)
[ ]*[0-9a-f]+:[ ]+40 c5 f9 28 00[ ]+rex vmovapd \(%rax\),%xmm0
[ ]*[0-9a-f]+:[ ]+40[ ]+rex
[ ]*[0-9a-f]+:[ ]+41[ ]+rex.B
diff --git a/gas/testsuite/gas/i386/rex.s b/gas/testsuite/gas/i386/rex.s
index 055edb7..004b9b8 100644
--- a/gas/testsuite/gas/i386/rex.s
+++ b/gas/testsuite/gas/i386/rex.s
@@ -10,6 +10,9 @@ _start:
rex/fxsave (%r8,%r8)
rex64/fxsave (%r8,%r8)
+ .byte 0x41,0x9b,0xdd,0x30
+ fsave (%r8)
+
.byte 0x40
vmovapd (%rax),%xmm0
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index dc8f149..0eec43f 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-24 Roland McGrath <mcgrathr@google.com>
+
+ * i386-dis.c (ckprefix): When bailing out for fwait with prefixes,
+ set rex_used to rex.
+
2012-10-22 Peter Bergner <bergner@vnet.ibm.com>
* ppc-opc.c (powerpc_opcodes) <vcfpsxws>: Fix opcode spelling.
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 15c968a..f8e62aa 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -10756,6 +10756,9 @@ ckprefix (void)
{
prefixes |= PREFIX_FWAIT;
codep++;
+ /* This ensures that the previous REX prefixes are noticed
+ as unused prefixes, as in the return case below. */
+ rex_used = rex;
return 1;
}
prefixes = PREFIX_FWAIT;
@@ -11481,7 +11484,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
i < (int) ARRAY_SIZE (all_prefixes) && all_prefixes[i];
i++)
(*info->fprintf_func) (info->stream, "%s%s",
- i == 0 ? "" : " ",
+ i == 0 ? "" : " ",
prefix_name (all_prefixes[i], sizeflag));
return i;
}
@@ -11576,7 +11579,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
{
dp = get_valid_dis386 (dp, info);
if (dp != NULL && putop (dp->name, sizeflag) == 0)
- {
+ {
get_sib (info);
for (i = 0; i < MAX_OPERANDS; ++i)
{
@@ -11659,13 +11662,13 @@ print_insn (bfd_vma pc, disassemble_info *info)
bfd_vma riprel;
for (i = 0; i < MAX_OPERANDS; ++i)
- op_txt[i] = op_out[i];
+ op_txt[i] = op_out[i];
for (i = 0; i < (MAX_OPERANDS >> 1); ++i)
{
- op_ad = op_index[i];
- op_index[i] = op_index[MAX_OPERANDS - 1 - i];
- op_index[MAX_OPERANDS - 1 - i] = op_ad;
+ op_ad = op_index[i];
+ op_index[i] = op_index[MAX_OPERANDS - 1 - i];
+ op_index[MAX_OPERANDS - 1 - i] = op_ad;
riprel = op_riprel[i];
op_riprel[i] = op_riprel [MAX_OPERANDS - 1 - i];
op_riprel[MAX_OPERANDS - 1 - i] = riprel;
@@ -11674,7 +11677,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
else
{
for (i = 0; i < MAX_OPERANDS; ++i)
- op_txt[MAX_OPERANDS - 1 - i] = op_out[i];
+ op_txt[MAX_OPERANDS - 1 - i] = op_out[i];
}
needcomma = 0;
@@ -12345,7 +12348,7 @@ case_L:
if (intel_syntax)
break;
if (address_mode == mode_64bit
- && ((sizeflag & DFLAG) || (rex & REX_W)))
+ && ((sizeflag & DFLAG) || (rex & REX_W)))
{
if (modrm.mod != 3 || (sizeflag & SUFFIX_ALWAYS))
*obufp++ = 'q';
@@ -12418,7 +12421,7 @@ case_Q:
if (intel_syntax)
break;
if (address_mode == mode_64bit
- && ((sizeflag & DFLAG) || (rex & REX_W)))
+ && ((sizeflag & DFLAG) || (rex & REX_W)))
{
if (sizeflag & SUFFIX_ALWAYS)
*obufp++ = 'q';
@@ -13534,7 +13537,7 @@ OP_REG (int code, int sizeflag)
case rAX_reg: case rCX_reg: case rDX_reg: case rBX_reg:
case rSP_reg: case rBP_reg: case rSI_reg: case rDI_reg:
if (address_mode == mode_64bit
- && ((sizeflag & DFLAG) || (rex & REX_W)))
+ && ((sizeflag & DFLAG) || (rex & REX_W)))
{
s = names64[code - rAX_reg + add];
break;
@@ -13665,7 +13668,7 @@ OP_I (int bytemode, int sizeflag)
break;
case const_1_mode:
if (intel_syntax)
- oappend ("1");
+ oappend ("1");
return;
default:
oappend (INTERNAL_DISASSEMBLER_ERROR);
@@ -13751,8 +13754,8 @@ OP_sI (int bytemode, int sizeflag)
if (address_mode != mode_64bit
|| !((sizeflag & DFLAG) || (rex & REX_W)))
{
- /* The operand-size prefix is overridden by a REX prefix. */
- if ((sizeflag & DFLAG) || (rex & REX_W))
+ /* The operand-size prefix is overridden by a REX prefix. */
+ if ((sizeflag & DFLAG) || (rex & REX_W))
op &= 0xffffffff;
else
op &= 0xffff;
@@ -14118,7 +14121,7 @@ OP_EM (int bytemode, int sizeflag)
{
bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
used_prefixes |= (prefixes & PREFIX_DATA);
- }
+ }
OP_E (bytemode, sizeflag);
return;
}
@@ -14157,7 +14160,7 @@ OP_EMC (int bytemode, int sizeflag)
{
bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode;
used_prefixes |= (prefixes & PREFIX_DATA);
- }
+ }
OP_E (bytemode, sizeflag);
return;
}
@@ -14776,55 +14779,55 @@ get_vex_imm8 (int sizeflag, int opnum)
{
/* There are SIB/displacement bytes. */
if ((sizeflag & AFLAG) || address_mode == mode_64bit)
- {
+ {
/* 32/64 bit address mode */
- int base = modrm.rm;
+ int base = modrm.rm;
/* Check SIB byte. */
- if (base == 4)
- {
- FETCH_DATA (the_info, codep + 1);
- base = *codep & 7;
- /* When decoding the third source, don't increase
- bytes_before_imm as this has already been incremented
- by one in OP_E_memory while decoding the second
- source operand. */
- if (opnum == 0)
- bytes_before_imm++;
- }
-
- /* Don't increase bytes_before_imm when decoding the third source,
- it has already been incremented by OP_E_memory while decoding
- the second source operand. */
- if (opnum == 0)
- {
- switch (modrm.mod)
- {
- case 0:
- /* When modrm.rm == 5 or modrm.rm == 4 and base in
- SIB == 5, there is a 4 byte displacement. */
- if (base != 5)
- /* No displacement. */
- break;
- case 2:
- /* 4 byte displacement. */
- bytes_before_imm += 4;
- break;
- case 1:
- /* 1 byte displacement. */
- bytes_before_imm++;
- break;
- }
- }
- }
+ if (base == 4)
+ {
+ FETCH_DATA (the_info, codep + 1);
+ base = *codep & 7;
+ /* When decoding the third source, don't increase
+ bytes_before_imm as this has already been incremented
+ by one in OP_E_memory while decoding the second
+ source operand. */
+ if (opnum == 0)
+ bytes_before_imm++;
+ }
+
+ /* Don't increase bytes_before_imm when decoding the third source,
+ it has already been incremented by OP_E_memory while decoding
+ the second source operand. */
+ if (opnum == 0)
+ {
+ switch (modrm.mod)
+ {
+ case 0:
+ /* When modrm.rm == 5 or modrm.rm == 4 and base in
+ SIB == 5, there is a 4 byte displacement. */
+ if (base != 5)
+ /* No displacement. */
+ break;
+ case 2:
+ /* 4 byte displacement. */
+ bytes_before_imm += 4;
+ break;
+ case 1:
+ /* 1 byte displacement. */
+ bytes_before_imm++;
+ break;
+ }
+ }
+ }
else
{
/* 16 bit address mode */
- /* Don't increase bytes_before_imm when decoding the third source,
- it has already been incremented by OP_E_memory while decoding
- the second source operand. */
- if (opnum == 0)
- {
+ /* Don't increase bytes_before_imm when decoding the third source,
+ it has already been incremented by OP_E_memory while decoding
+ the second source operand. */
+ if (opnum == 0)
+ {
switch (modrm.mod)
{
case 0: