* [PATCH 1/2][Aarch64][binutils] Add support for PAN architecture extension.
@ 2015-05-20 12:18 Matthew Wahab
2015-05-29 14:55 ` Nicholas Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wahab @ 2015-05-20 12:18 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 880 bytes --]
The ARMv8.1 architecture introduced the Privileged Access Never extension. This
adds a processor state field PSTATE.PAN which can be accessed using the MRS/MSR
instructions.
This patch adds support for the PAN architecture feature and processor state
field to binutils. A following patch will add support to GAS.
Tested for aarch64-none-linux-gnu with check-binutils and check-gas with no
failures.
Ok for trunk?
include/opcode
2015-05-20 Matthew Wahab <matthew.wahab@arm.com>
* aarch64.h (AARCH64_FEATURE_PAN): New.
(aarch64_sys_reg_supported_p): Declare.
(aarch64_pstatefield_supported_p): Declare.
opcodes/
2015-05-20 Matthew Wahab <matthew.wahab@arm.com>
* aarch64-opc.c (F_ARCHEXT): New.
(aarch64_sys_regs): Add "pan".
(aarch64_sys_reg_supported_p): New.
(aarch64_pstatefields): Add "pan".
(aarch64_pstatefield_supported_p): New.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-binutils-support-for-PAN-extension.patch --]
[-- Type: text/x-patch; name=0001-Add-binutils-support-for-PAN-extension.patch, Size: 3767 bytes --]
From f70d30b3797028f609aa8af8ce5a2e75eec17432 Mon Sep 17 00:00:00 2001
From: Matthew Wahab <matthew.wahab@arm.com>
Date: Wed, 6 May 2015 14:22:50 +0100
Subject: [PATCH 1/2] Add binutils support for PAN extension.
Change-Id: I8fc388bc9f5ce568805ae3045a1bd5a2f0e8321a
---
include/opcode/aarch64.h | 5 +++++
opcodes/aarch64-opc.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/include/opcode/aarch64.h b/include/opcode/aarch64.h
index 7130d2d..8df82a1 100644
--- a/include/opcode/aarch64.h
+++ b/include/opcode/aarch64.h
@@ -39,6 +39,7 @@ typedef uint32_t aarch64_insn;
#define AARCH64_FEATURE_SIMD 0x00040000 /* SIMD instructions. */
#define AARCH64_FEATURE_CRC 0x00080000 /* CRC instructions. */
#define AARCH64_FEATURE_LSE 0x00100000 /* LSE instructions. */
+#define AARCH64_FEATURE_PAN 0x00200000 /* PAN instructions. */
/* Architectures are the sum of the base and extensions. */
#define AARCH64_ARCH_V8 AARCH64_FEATURE (AARCH64_FEATURE_V8, \
@@ -629,6 +630,10 @@ typedef struct
extern const aarch64_sys_reg aarch64_sys_regs [];
extern const aarch64_sys_reg aarch64_pstatefields [];
extern bfd_boolean aarch64_sys_reg_deprecated_p (const aarch64_sys_reg *);
+extern bfd_boolean aarch64_sys_reg_supported_p (const aarch64_feature_set,
+ const aarch64_sys_reg *);
+extern bfd_boolean aarch64_pstatefield_supported_p (const aarch64_feature_set,
+ const aarch64_sys_reg *);
typedef struct
{
diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c
index 5ea1384..5c7ef86 100644
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -2723,6 +2723,12 @@ aarch64_print_operand (char *buf, size_t size, bfd_vma pc,
#endif
#define F_DEPRECATED 0x1 /* Deprecated system register. */
+#ifdef F_ARCHEXT
+#undef F_ARCHEXT
+#endif
+#define F_ARCHEXT 0x2 /* Architecture dependent system register. */
+
+
/* TODO there are two more issues need to be resolved
1. handle read-only and write-only system registers
2. handle cpu-implementation-defined system registers. */
@@ -2734,6 +2740,7 @@ const aarch64_sys_reg aarch64_sys_regs [] =
{ "spsel", CPEN_(0,C2,0), 0 },
{ "daif", CPEN_(3,C2,1), 0 },
{ "currentel", CPEN_(0,C2,2), 0 }, /* RO */
+ { "pan", CPEN_(0,C2,3), F_ARCHEXT },
{ "nzcv", CPEN_(3,C2,0), 0 },
{ "fpcr", CPEN_(3,C4,0), 0 },
{ "fpsr", CPEN_(3,C4,1), 0 },
@@ -3043,14 +3050,45 @@ aarch64_sys_reg_deprecated_p (const aarch64_sys_reg *reg)
return (reg->flags & F_DEPRECATED) != 0;
}
+bfd_boolean
+aarch64_sys_reg_supported_p (const aarch64_feature_set features,
+ const aarch64_sys_reg *reg)
+{
+ if (!(reg->flags & F_ARCHEXT))
+ return TRUE;
+
+ /* PAN. Values are from aarch64_sys_regs. */
+ if (reg->value == CPEN_(0,C2,3)
+ && !AARCH64_CPU_HAS_FEATURE (features, AARCH64_FEATURE_PAN))
+ return FALSE;
+
+ return TRUE;
+}
+
const aarch64_sys_reg aarch64_pstatefields [] =
{
{ "spsel", 0x05, 0 },
{ "daifset", 0x1e, 0 },
{ "daifclr", 0x1f, 0 },
+ { "pan", 0x04, F_ARCHEXT },
{ 0, CPENC(0,0,0,0,0), 0 },
};
+bfd_boolean
+aarch64_pstatefield_supported_p (const aarch64_feature_set features,
+ const aarch64_sys_reg *reg)
+{
+ if (!(reg->flags & F_ARCHEXT))
+ return TRUE;
+
+ /* PAN. Values are from aarch64_pstatefields. */
+ if (reg->value == 0x04
+ && !AARCH64_CPU_HAS_FEATURE (features, AARCH64_FEATURE_PAN))
+ return FALSE;
+
+ return TRUE;
+}
+
const aarch64_sys_ins_reg aarch64_sys_regs_ic[] =
{
{ "ialluis", CPENS(0,C7,C1,0), 0 },
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2][Aarch64][binutils] Add support for PAN architecture extension.
2015-05-20 12:18 [PATCH 1/2][Aarch64][binutils] Add support for PAN architecture extension Matthew Wahab
@ 2015-05-29 14:55 ` Nicholas Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Clifton @ 2015-05-29 14:55 UTC (permalink / raw)
To: Matthew Wahab, binutils
Hi Matthew,
> include/opcode
> 2015-05-20 Matthew Wahab <matthew.wahab@arm.com>
>
> * aarch64.h (AARCH64_FEATURE_PAN): New.
> (aarch64_sys_reg_supported_p): Declare.
> (aarch64_pstatefield_supported_p): Declare.
>
> opcodes/
> 2015-05-20 Matthew Wahab <matthew.wahab@arm.com>
> * aarch64-opc.c (F_ARCHEXT): New.
> (aarch64_sys_regs): Add "pan".
> (aarch64_sys_reg_supported_p): New.
> (aarch64_pstatefields): Add "pan".
> (aarch64_pstatefield_supported_p): New.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-29 14:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20 12:18 [PATCH 1/2][Aarch64][binutils] Add support for PAN architecture extension Matthew Wahab
2015-05-29 14:55 ` Nicholas Clifton
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).