public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrea Corallo <andrea.corallo@arm.com>
To: Binutils <binutils@sourceware.org>
Cc: "richard.earnshaw@arm.com" <richard.earnshaw@arm.com>
Subject: PATCH [7/10] arm: add 'bxaut' instruction for Armv8.1-M pacbti extension
Date: Tue, 20 Jul 2021 17:38:52 +0200	[thread overview]
Message-ID: <gkr5yx5ov03.fsf@arm.com> (raw)
Message-ID: <20210720153852.UFuS0rKKx1VSs16lMTniMyDzkdB4jMwhh6tH95RssTs@z> (raw)

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

Hi all,

seventh patch of the series adding support for PACBTI for Cortex-M.

This is to add the 'bxaut' instruction.

See:
- Armv8.1-M Pointer Authentication and Branch Target Identification Extension [1]
- Armv8-M Architecture Reference Manual [2]

The series was tested and does not introduce regressions.

Regards

  Andrea

[1] <https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension>
[2] <https://developer.arm.com/documentation/ddi0553/latest>


[-- Attachment #2: 0007-PATCH-7-10-arm-add-bxaut-instruction-for-Armv8.1-M-p.patch --]
[-- Type: text/plain, Size: 3970 bytes --]

From 86ca3e580342a231b50cdadd10034c771b178eb1 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <andrea.corallo@arm.com>
Date: Wed, 19 May 2021 15:04:24 +0200
Subject: [PATCH 07/10] PATCH [7/10] arm: add 'bxaut' instruction for Armv8.1-M
 pacbti extension

gas/
2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>

	* config/tc-arm.c (T16_32_TAB): Add '_bxaut'.
	(do_t_pacbti_nonop): New function.
	(insns): Define 'bxaut' insn.
	* testsuite/gas/arm/armv8_1-m-pacbti.d: Add 'bxaut' test.
	* testsuite/gas/arm/armv8_1-m-pacbti.s: Likewise.

opcodes/
2021-06-11  Andrea Corallo  <andrea.corallo@arm.com>

	* arm-dis.c (thumb32_opcodes): Add 'bxaut'.
---
 gas/config/tc-arm.c                      | 14 ++++++++++++++
 gas/testsuite/gas/arm/armv8_1-m-pacbti.d |  3 ++-
 gas/testsuite/gas/arm/armv8_1-m-pacbti.s |  1 +
 opcodes/arm-dis.c                        |  2 ++
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 3ec353abf78..30ef1991249 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -11463,6 +11463,7 @@ encode_thumb32_addr_mode (int i, bool is_t, bool is_d)
   X(_bflx,  0000, f070e001),			\
   X(_bic,   4380, ea200000),			\
   X(_bics,  4380, ea300000),			\
+  X(_bxaut, 0000, fb500f10),			\
   X(_cinc,  0000, ea509000),			\
   X(_cinv,  0000, ea50a000),			\
   X(_cmn,   42c0, eb100f00),			\
@@ -22343,6 +22344,18 @@ do_t_pacbti (void)
   inst.instruction = THUMB_OP32 (inst.instruction);
 }
 
+static void
+do_t_pacbti_nonop (void)
+{
+  constraint (!ARM_CPU_HAS_FEATURE (cpu_variant, pacbti_ext),
+	      _(BAD_PACBTI));
+
+  inst.instruction = THUMB_OP32 (inst.instruction);
+  inst.instruction |= inst.operands[0].reg << 12;
+  inst.instruction |= inst.operands[1].reg << 16;
+  inst.instruction |= inst.operands[2].reg;
+}
+
 \f
 /* Overall per-instruction processing.	*/
 
@@ -26333,6 +26346,7 @@ static const struct asm_opcode insns[] =
 #define THUMB_VARIANT & arm_ext_v8_1m_main
  toU("aut",   _aut, 3, (R12, LR, SP), t_pacbti),
  ToU("bti",   f3af800f, 0, (), noargs),
+ toU("bxaut", _bxaut, 3, (RR, RR, RR), t_pacbti_nonop),
  toU("pac",   _pac,   3, (R12, LR, SP), t_pacbti),
  toU("pacbti", _pacbti, 3, (R12, LR, SP), t_pacbti),
  toU("cinc",  _cinc,  3, (RRnpcsp, RR_ZR, COND),	t_cond),
diff --git a/gas/testsuite/gas/arm/armv8_1-m-pacbti.d b/gas/testsuite/gas/arm/armv8_1-m-pacbti.d
index 9df123af8eb..411454a5fd1 100644
--- a/gas/testsuite/gas/arm/armv8_1-m-pacbti.d
+++ b/gas/testsuite/gas/arm/armv8_1-m-pacbti.d
@@ -1,6 +1,6 @@
 #name: Valid Armv8.1-M pointer authentication and branch target identification extention
 #source: armv8_1-m-pacbti.s
-#as: -march=armv8.1-m.main
+#as: -march=armv8.1-m.main+pacbti
 #objdump: -dr --prefix-addresses --show-raw-insn
 
 .*: +file format .*arm.*
@@ -10,4 +10,5 @@ Disassembly of section .text:
 0[0-9a-f]+ <[^>]+> f3af 800d 	pacbti	r12, lr, sp
 0[0-9a-f]+ <[^>]+> f3af 802d 	aut	r12, lr, sp
 0[0-9a-f]+ <[^>]+> f3af 801d 	pac	r12, lr, sp
+0[0-9a-f]+ <[^>]+> fb54 3f15 	bxaut	r3, r4, r5
 #...
diff --git a/gas/testsuite/gas/arm/armv8_1-m-pacbti.s b/gas/testsuite/gas/arm/armv8_1-m-pacbti.s
index 38000c3fc0d..22da2cefb4e 100644
--- a/gas/testsuite/gas/arm/armv8_1-m-pacbti.s
+++ b/gas/testsuite/gas/arm/armv8_1-m-pacbti.s
@@ -6,3 +6,4 @@
 	pacbti	r12, lr, sp
 	aut	r12, lr, sp
 	pac	r12, lr, sp
+	bxaut	r3, r4, r5
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 930fbbfa385..1d183605030 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -4658,6 +4658,8 @@ static const struct opcode32 thumb32_opcodes[] =
    0xf3af802d, 0xffffffff, "aut\tr12, lr, sp"},
   {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_1M_MAIN),
    0xf3af800f, 0xffffffff, "bti"},
+  {ARM_FEATURE_CORE_HIGH_HIGH (ARM_EXT3_PACBTI),
+   0xfb500f10, 0xfff00ff0, "bxaut%c\t%12-15r, %16-19r, %0-3r"},
   {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_1M_MAIN),
    0xf3af801d, 0xffffffff, "pac\tr12, lr, sp"},
   {ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_1M_MAIN),
-- 
2.20.1


             reply	other threads:[~2021-07-20 15:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 15:38 Andrea Corallo [this message]
2021-07-20 15:38 ` PATCH [4/10] arm: add 'pac' " Andrea Corallo
2021-07-20 15:38 ` PATCH V2 [2/10] arm: add 'pacbti' " Andrea Corallo
2021-07-20 15:38 ` PATCH [3/10] arm: add 'aut' " Andrea Corallo
2021-07-20 15:38 ` PATCH [2/4] arm: Add Tag_BTI_extension build attribute Andrea Corallo
2021-07-20 15:38 ` PATCH [4/4] arm: Add Tag_PACRET_use " Andrea Corallo
2021-07-20 15:38 ` PATCH [3/4] arm: Add Tag_BTI_use " Andrea Corallo
2021-07-20 15:38 ` PATCH [9/10] arm: add 'pacg' instruction for Armv8.1-M pacbti extension Andrea Corallo
2021-07-20 15:38 ` PATCH [5/10] arm: Extend again arm_feature_set struct to provide more bits Andrea Corallo
2021-07-20 15:38 ` PATCH [6/10] arm: Add -march=armv8.1-m.main+pacbti flag Andrea Corallo
2021-07-20 15:38 ` PATCH [10/10] arm: Alias 'ra_auth_code' to r12 for pacbti Andrea Corallo
2021-07-20 15:38 ` PATCH [7/10] arm: add 'bxaut' instruction for Armv8.1-M pacbti extension Andrea Corallo
2021-07-20 15:38 ` PATCH [8/10] arm: add 'autg' " Andrea Corallo
2021-07-21 14:31 ` PATCH [1/10] arm: add 'bti' " Nick Clifton
2021-07-21 15:12   ` Andrea Corallo
2021-07-26 12:32   ` Andrea Corallo
2021-08-10 15:31 ` PATCH [2/4] arm: Add Tag_BTI_extension build attribute Nick Clifton
2021-08-17 12:59   ` Andrea Corallo
2021-08-10 15:32 ` PATCH [3/4] arm: Add Tag_BTI_use " Nick Clifton
2021-08-10 15:33 ` PATCH [4/4] arm: Add Tag_PACRET_use " Nick Clifton
2021-08-10 15:33 ` PATCH V2 [2/10] arm: add 'pacbti' instruction for Armv8.1-M pacbti extension Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gkr5yx5ov03.fsf@arm.com \
    --to=andrea.corallo@arm.com \
    --cc=binutils@sourceware.org \
    --cc=richard.earnshaw@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).