[PATCH] x86: Avoid abort on invalid broadcast
H.J. Lu
hjl.tools@gmail.com
Thu Aug 19 14:02:59 GMT 2021
Print "{bad}" on invalid broadcast instead of abort.
gas/
PR binutils/28247
* testsuite/gas/i386/bad-bcast.d: New file.
* testsuite/gas/i386/bad-bcast.s: Likewise.
* testsuite/gas/i386/i386.exp: Run bad-bcast.
opcodes/
PR binutils/28247
* i386-dis.c (OP_E_memory): Print "{bad}" on invalid broadcast
instead of abort.
---
gas/testsuite/gas/i386/bad-bcast.d | 14 ++++++++++++++
gas/testsuite/gas/i386/bad-bcast.s | 2 ++
gas/testsuite/gas/i386/i386.exp | 1 +
opcodes/i386-dis.c | 8 ++++----
4 files changed, 21 insertions(+), 4 deletions(-)
create mode 100644 gas/testsuite/gas/i386/bad-bcast.d
create mode 100644 gas/testsuite/gas/i386/bad-bcast.s
diff --git a/gas/testsuite/gas/i386/bad-bcast.d b/gas/testsuite/gas/i386/bad-bcast.d
new file mode 100644
index 00000000000..9fc474a42ff
--- /dev/null
+++ b/gas/testsuite/gas/i386/bad-bcast.d
@@ -0,0 +1,14 @@
+#objdump: -dw
+#name: Disassemble bad broadcast
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <.text>:
+ +[a-f0-9]+: 62 .byte 0x62
+ +[a-f0-9]+: c3 ret
+ +[a-f0-9]+: 8c 1d 66 90 66 90 mov %ds,0x90669066
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+#pass
diff --git a/gas/testsuite/gas/i386/bad-bcast.s b/gas/testsuite/gas/i386/bad-bcast.s
new file mode 100644
index 00000000000..e09c3aae5de
--- /dev/null
+++ b/gas/testsuite/gas/i386/bad-bcast.s
@@ -0,0 +1,2 @@
+ .text
+ .byte 0x62, 0xc3, 0x8c, 0x1d, 0x66, 0x90, 0x66, 0x90, 0x66, 0x90
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index f5eda2cf331..80959726d0e 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -646,6 +646,7 @@ if [gas_32_check] then {
run_dump_test "dw2-compress-2"
run_dump_test "dw2-compressed-2"
+ run_dump_test "bad-bcast"
run_dump_test "bad-size"
run_dump_test "size-1"
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 2c7027ca6f1..acb5a0faa88 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -11912,7 +11912,7 @@ OP_E_memory (int bytemode, int sizeflag)
{
if (vex.w)
{
- abort ();
+ oappend ("{bad}");
}
else
{
@@ -11928,7 +11928,7 @@ OP_E_memory (int bytemode, int sizeflag)
oappend ("{1to32}");
break;
default:
- abort ();
+ oappend ("{bad}");
}
}
}
@@ -11948,7 +11948,7 @@ OP_E_memory (int bytemode, int sizeflag)
oappend ("{1to8}");
break;
default:
- abort ();
+ oappend ("{bad}");
}
}
else if (bytemode == x_mode
@@ -11966,7 +11966,7 @@ OP_E_memory (int bytemode, int sizeflag)
oappend ("{1to16}");
break;
default:
- abort ();
+ oappend ("{bad}");
}
}
else
--
2.31.1
More information about the Binutils
mailing list