aboutsummaryrefslogtreecommitdiff
path: root/gas/config
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/config
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/config')
-rw-r--r--gas/config/tc-aarch64.c85
1 files changed, 22 insertions, 63 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;