]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
aarch64: Add FEAT_ECBHB support
authorAndrea Corallo <andrea.corallo@arm.com>
Tue, 12 Sep 2023 10:23:52 +0000 (11:23 +0100)
committerAndrea Corallo <andrea.corallo@arm.com>
Tue, 19 Dec 2023 14:35:49 +0000 (15:35 +0100)
This patch add support for FEAT_ECBHB "Exploitative control using
branch history information" adding the "clrbhb" instruction.  AFAIU
the same alias was originally added as "clearbhb" before the
architecture was finalized (Mandatory v8.9-a/v9.4-a; Optional
v8.0-a+/v9.0-a+).

gas/testsuite/gas/aarch64/clrbhb-1.d [new file with mode: 0644]
gas/testsuite/gas/aarch64/clrbhb-1.s [new file with mode: 0644]
gas/testsuite/gas/aarch64/system.d
opcodes/aarch64-asm-2.c
opcodes/aarch64-dis-2.c
opcodes/aarch64-tbl.h

diff --git a/gas/testsuite/gas/aarch64/clrbhb-1.d b/gas/testsuite/gas/aarch64/clrbhb-1.d
new file mode 100644 (file)
index 0000000..272ee23
--- /dev/null
@@ -0,0 +1,9 @@
+#objdump: -dr
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0+ <.*>:
+   0:  d50322df        clrbhb
+
diff --git a/gas/testsuite/gas/aarch64/clrbhb-1.s b/gas/testsuite/gas/aarch64/clrbhb-1.s
new file mode 100644 (file)
index 0000000..edf8846
--- /dev/null
@@ -0,0 +1,2 @@
+       clrbhb
+
index dbb7c0a96ffbe7043865f29dd04cab6807388dd0..c1400771d43ca92f6ee150965a104e89e93af799 100644 (file)
@@ -14,7 +14,7 @@ Disassembly of section \.text:
 .*:    d503207f        wfi
 .*:    d503209f        sev
 .*:    d50320bf        sevl
-.*:    d50322df        clearbhb
+.*:    d50322df        clrbhb
 .*:    d503201f        nop
 .*:    d503203f        yield
 .*:    d503205f        wfe
@@ -37,7 +37,7 @@ Disassembly of section \.text:
 .*:    d503227f        (hint   #0x13|gcsb      dsync)
 .*:    d503229f        (hint   #0x14|csdb)
 .*:    d50322bf        hint    #0x15
-.*:    d50322df        (hint   #0x16|clearbhb)
+.*:    d50322df        (hint   #0x16|clrbhb)
 .*:    d50322ff        hint    #0x17
 .*:    d503231f        (hint   #0x18|paciaz)
 .*:    d503233f        (hint   #0x19|paciasp)
index ae0119a55f6275359197ca43185af1f0c33faaf9..e9b9ce27f8d81eb5f115c8af35ba45539dbcfcd1 100644 (file)
@@ -426,6 +426,7 @@ aarch64_find_real_opcode (const aarch64_opcode *opcode)
     case 1200: /* movz */
       value = 1200;    /* --> movz.  */
       break;
+    case 3193: /* clrbhb */
     case 1276: /* autibsp */
     case 1275: /* autibz */
     case 1274: /* autiasp */
index 38d72a715669bc8d53197d717cce25a46e2aedc4..977b1c1303eac364c2b291b5bddb96506a5f1bba 100644 (file)
@@ -31321,7 +31321,7 @@ aarch64_find_alias_opcode (const aarch64_opcode *opcode)
     case 1136: value = 1185; break;    /* lduminl --> stuminl.  */
     case 1198: value = 1199; break;    /* movn --> mov.  */
     case 1200: value = 1201; break;    /* movz --> mov.  */
-    case 1215: value = 1276; break;    /* hint --> autibsp.  */
+    case 1215: value = 3193; break;    /* hint --> clrbhb.  */
     case 1235: value = 1239; break;    /* dsb --> pssbb.  */
     case 1236: value = 1236; break;    /* dsb --> dsb.  */
     case 1254: value = 1264; break;    /* sys --> cosp.  */
@@ -31481,6 +31481,7 @@ aarch64_find_next_alias_opcode (const aarch64_opcode *opcode)
     case 1185: value = 1136; break;    /* stuminl --> lduminl.  */
     case 1199: value = 1198; break;    /* mov --> movn.  */
     case 1201: value = 1200; break;    /* mov --> movz.  */
+    case 3193: value = 1276; break;    /* clrbhb --> autibsp.  */
     case 1276: value = 1275; break;    /* autibsp --> autibz.  */
     case 1275: value = 1274; break;    /* autibz --> autiasp.  */
     case 1274: value = 1273; break;    /* autiasp --> autiaz.  */
index 4ef28be098ac6515908b9f257dfb1660b634eeda..6734794ba561b109875576c43801c2fd98ebc094 100644 (file)
@@ -6113,6 +6113,10 @@ const struct aarch64_opcode aarch64_opcode_table[] =
   CSSC_INSN ("smin", 0x1ac06800, 0x7fe0fc00, OP3 (Rd, Rn, Rm), QL_I3SAMER, F_SF),
   CSSC_INSN ("umin", 0x1ac06c00, 0x7fe0fc00, OP3 (Rd, Rn, Rm), QL_I3SAMER, F_SF),
 
+  /* FEAT_CLRBHB part of the hint space and available without special
+     command-line flags.  */
+  CORE_INSN ("clrbhb", 0xd50322df, 0xffffffff, ic_system, 0, OP0 (), {}, F_ALIAS),
+
   {0, 0, 0, 0, 0, 0, {}, {}, 0, 0, 0, NULL},
 };