aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorSrinath Parvathaneni <srinath.parvathaneni@arm.com>2023-11-02 13:07:29 +0000
committersrinath <srinath.parvathaneni@arm.com>2023-11-02 13:09:26 +0000
commitc58f84d899b58822c57a780161a173f32b4f6abf (patch)
treed590029a225032ef25aa18bdf8c10f615fb7e8d3 /gas
parentf985c2512aee1c4440998db62d6aea98c737b3ef (diff)
downloadgdb-c58f84d899b58822c57a780161a173f32b4f6abf.zip
gdb-c58f84d899b58822c57a780161a173f32b4f6abf.tar.gz
gdb-c58f84d899b58822c57a780161a173f32b4f6abf.tar.bz2
aarch64: Add support for GCSB DSYNC instruction.
This patch adds support for Guarded control stack data synchronization instruction (GCSB DSYNC). This instruction is allocated to existing HINT space and uses the HINT number 19 and to match this an entry is added to the aarch64_hint_options array.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-aarch64.c85
-rw-r--r--gas/testsuite/gas/aarch64/gcs-1.d1
-rw-r--r--gas/testsuite/gas/aarch64/gcs-1.s1
-rw-r--r--gas/testsuite/gas/aarch64/hint-bad.d4
-rw-r--r--gas/testsuite/gas/aarch64/hint-bad.l8
-rw-r--r--gas/testsuite/gas/aarch64/hint-bad.s8
-rw-r--r--gas/testsuite/gas/aarch64/system.d2
7 files changed, 45 insertions, 64 deletions
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 6d20400..1f687fe 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -4417,47 +4417,13 @@ parse_barrier (char **str)
return o->value;
}
-/* Parse an operand for a PSB barrier. Set *HINT_OPT to the hint-option record
- return 0 if successful. Otherwise return PARSE_FAIL. */
+/* Parse an option for barrier, bti and guarded control stack data
+ synchronization instructions. Return true on matching the target
+ options else return false. */
-static int
-parse_barrier_psb (char **str,
- const struct aarch64_name_value_pair ** hint_opt)
-{
- char *p, *q;
- const struct aarch64_name_value_pair *o;
-
- p = q = *str;
- while (ISALPHA (*q))
- q++;
-
- o = str_hash_find_n (aarch64_hint_opt_hsh, p, q - p);
- if (!o)
- {
- set_fatal_syntax_error
- ( _("unknown or missing option to PSB/TSB"));
- return PARSE_FAIL;
- }
-
- if (o->value != 0x11)
- {
- /* PSB only accepts option name 'CSYNC'. */
- set_syntax_error
- (_("the specified option is not accepted for PSB/TSB"));
- return PARSE_FAIL;
- }
-
- *str = q;
- *hint_opt = o;
- return 0;
-}
-
-/* Parse an operand for BTI. Set *HINT_OPT to the hint-option record
- return 0 if successful. Otherwise return PARSE_FAIL. */
-
-static int
-parse_bti_operand (char **str,
- const struct aarch64_name_value_pair ** hint_opt)
+static bool
+parse_hint_opt (const char *name, char **str,
+ const struct aarch64_name_value_pair ** hint_opt)
{
char *p, *q;
const struct aarch64_name_value_pair *o;
@@ -4468,29 +4434,19 @@ parse_bti_operand (char **str,
o = str_hash_find_n (aarch64_hint_opt_hsh, p, q - p);
if (!o)
- {
- set_fatal_syntax_error
- ( _("unknown option to BTI"));
- return PARSE_FAIL;
- }
-
- switch (o->value)
- {
- /* Valid BTI operands. */
- case HINT_OPD_C:
- case HINT_OPD_J:
- case HINT_OPD_JC:
- break;
+ return false;
- default:
- set_syntax_error
- (_("unknown option to BTI"));
- return PARSE_FAIL;
- }
+ if ((strcmp ("gcsb", name) == 0 && o->value != HINT_OPD_DSYNC)
+ || ((strcmp ("psb", name) == 0 || strcmp ("tsb", name) == 0)
+ && o->value != HINT_OPD_CSYNC)
+ || ((strcmp ("bti", name) == 0)
+ && (o->value != HINT_OPD_C && o->value != HINT_OPD_J
+ && o->value != HINT_OPD_JC)))
+ return false;
*str = q;
*hint_opt = o;
- return 0;
+ return true;
}
/* Parse STR for reg of REG_TYPE and following '.' and QUALIFIER.
@@ -7777,8 +7733,7 @@ parse_operands (char *str, const aarch64_opcode *opcode)
break;
case AARCH64_OPND_BARRIER_PSB:
- val = parse_barrier_psb (&str, &(info->hint_option));
- if (val == PARSE_FAIL)
+ if (!parse_hint_opt (opcode->name, &str, &(info->hint_option)))
goto failure;
break;
@@ -7833,9 +7788,13 @@ parse_operands (char *str, const aarch64_opcode *opcode)
info->qualifier = vectype_to_qualifier (&vectype);
break;
+ case AARCH64_OPND_BARRIER_GCSB:
+ if (!parse_hint_opt (opcode->name, &str, &(info->hint_option)))
+ goto failure;
+ break;
+
case AARCH64_OPND_BTI_TARGET:
- val = parse_bti_operand (&str, &(info->hint_option));
- if (val == PARSE_FAIL)
+ if (!parse_hint_opt (opcode->name, &str, &(info->hint_option)))
goto failure;
break;
diff --git a/gas/testsuite/gas/aarch64/gcs-1.d b/gas/testsuite/gas/aarch64/gcs-1.d
index 51f9dd6..09fa418 100644
--- a/gas/testsuite/gas/aarch64/gcs-1.d
+++ b/gas/testsuite/gas/aarch64/gcs-1.d
@@ -12,6 +12,7 @@
.*: d50877bf gcspopcx
.*: d50877df gcspopx
.*: d52b773f gcspopm
+.*: d503227f gcsb dsync
.*: d50b7700 gcspushm x0
.*: d50b770f gcspushm x15
.*: d50b771e gcspushm x30
diff --git a/gas/testsuite/gas/aarch64/gcs-1.s b/gas/testsuite/gas/aarch64/gcs-1.s
index 9706587..35584a8 100644
--- a/gas/testsuite/gas/aarch64/gcs-1.s
+++ b/gas/testsuite/gas/aarch64/gcs-1.s
@@ -3,6 +3,7 @@
gcspopcx
gcspopx
gcspopm
+ gcsb dsync
.irp op gcspushm, gcsss1, gcsss2, gcspopm
.irp reg1 x0, x15, x30, xzr
diff --git a/gas/testsuite/gas/aarch64/hint-bad.d b/gas/testsuite/gas/aarch64/hint-bad.d
new file mode 100644
index 0000000..e881fc9
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/hint-bad.d
@@ -0,0 +1,4 @@
+#name: Barrier and BTI instructions with wrong targets.
+#as: -march=armv8-a
+#source: hint-bad.s
+#error_output: hint-bad.l
diff --git a/gas/testsuite/gas/aarch64/hint-bad.l b/gas/testsuite/gas/aarch64/hint-bad.l
new file mode 100644
index 0000000..57caed1
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/hint-bad.l
@@ -0,0 +1,8 @@
+[^ :]+: Assembler messages:
+[^ :]+:[0-9]+: Error: operand 1 must be the GCSB option name DSYNC -- `gcsb'
+[^ :]+:[0-9]+: Error: operand 1 must be the GCSB option name DSYNC -- `gcsb csync'
+[^ :]+:[0-9]+: Error: operand 1 must be the PSB/TSB option name CSYNC -- `psb'
+[^ :]+:[0-9]+: Error: operand 1 must be the PSB/TSB option name CSYNC -- `psb dsync'
+[^ :]+:[0-9]+: Error: operand 1 must be the PSB/TSB option name CSYNC -- `tsb'
+[^ :]+:[0-9]+: Error: operand 1 must be the PSB/TSB option name CSYNC -- `tsb dsync'
+[^ :]+:[0-9]+: Error: operand 1 must be BTI targets j/c/jc -- `bti jj'
diff --git a/gas/testsuite/gas/aarch64/hint-bad.s b/gas/testsuite/gas/aarch64/hint-bad.s
new file mode 100644
index 0000000..319b859
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/hint-bad.s
@@ -0,0 +1,8 @@
+ .text
+ gcsb
+ gcsb csync
+ psb
+ psb dsync
+ tsb
+ tsb dsync
+ bti jj
diff --git a/gas/testsuite/gas/aarch64/system.d b/gas/testsuite/gas/aarch64/system.d
index 8ad2746..bb1a94c 100644
--- a/gas/testsuite/gas/aarch64/system.d
+++ b/gas/testsuite/gas/aarch64/system.d
@@ -34,7 +34,7 @@ Disassembly of section \.text:
.*: d503221f (hint #0x10|esb)
.*: d503223f (hint #0x11|psb csync)
.*: d503225f (hint #0x12|tsb csync)
-.*: d503227f hint #0x13
+.*: d503227f (hint #0x13|gcsb dsync)
.*: d503229f (hint #0x14|csdb)
.*: d50322bf hint #0x15
.*: d50322df (hint #0x16|clearbhb)