mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-15 13:48:26 +08:00
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.
This commit is contained in:
committed by
srinath
parent
f985c2512a
commit
c58f84d899
@@ -4417,12 +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)
|
||||
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;
|
||||
@@ -4433,64 +4434,19 @@ parse_barrier_psb (char **str,
|
||||
|
||||
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;
|
||||
}
|
||||
return false;
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
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 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;
|
||||
|
||||
default:
|
||||
set_syntax_error
|
||||
(_("unknown option to BTI"));
|
||||
return PARSE_FAIL;
|
||||
}
|
||||
|
||||
*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;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
.*: d50877bf gcspopcx
|
||||
.*: d50877df gcspopx
|
||||
.*: d52b773f gcspopm
|
||||
.*: d503227f gcsb dsync
|
||||
.*: d50b7700 gcspushm x0
|
||||
.*: d50b770f gcspushm x15
|
||||
.*: d50b771e gcspushm x30
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
gcspopcx
|
||||
gcspopx
|
||||
gcspopm
|
||||
gcsb dsync
|
||||
|
||||
.irp op gcspushm, gcsss1, gcsss2, gcspopm
|
||||
.irp reg1 x0, x15, x30, xzr
|
||||
|
||||
4
gas/testsuite/gas/aarch64/hint-bad.d
Normal file
4
gas/testsuite/gas/aarch64/hint-bad.d
Normal file
@@ -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
|
||||
8
gas/testsuite/gas/aarch64/hint-bad.l
Normal file
8
gas/testsuite/gas/aarch64/hint-bad.l
Normal file
@@ -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'
|
||||
8
gas/testsuite/gas/aarch64/hint-bad.s
Normal file
8
gas/testsuite/gas/aarch64/hint-bad.s
Normal file
@@ -0,0 +1,8 @@
|
||||
.text
|
||||
gcsb
|
||||
gcsb csync
|
||||
psb
|
||||
psb dsync
|
||||
tsb
|
||||
tsb dsync
|
||||
bti jj
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user