DDI0600B A Armv8 r64 Supplement
DDI0600B A Armv8 r64 Supplement
Supplement
Armv8, for R-profile AArch64 architecture
Release history
Proprietary Notice
This document is protected by copyright and other related rights and the practice or implementation of the information contained
in this document may be protected by one or more patents or pending patent applications. No part of this document may be
reproduced in any form by any means without the express prior written permission of Arm. No license, express or implied, by
estoppel or otherwise to any intellectual property rights is granted by this document unless specifically stated.
Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use
the information for the purposes of determining whether implementations infringe any third party patents.
THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES,
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR
PURPOSE WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, Arm makes no representation with respect to,
and has undertaken no analysis to identify or understand the scope and content of, patents, copyrights, trade secrets, or other rights.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES,
INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR
CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING
OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure
of this document complies fully with any relevant export laws and regulations to assure that this document or any portion thereof
is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to Arm’s customers
is not intended to create or refer to any partnership relationship with any other company. Arm may make changes to this document
at any time and without notice.
This document may be translated into other languages for convenience, and you agree that if there is any conflict between the
English version of this document and any translation, the terms of the English version of the Agreement shall prevail.
The Arm corporate logo and words marked with ® or ™ are registered trademarks or trademarks of Arm Limited (or its affiliates)
in the US and/or elsewhere. All rights reserved. Other brands and names mentioned in this document may be the trademarks of
their respective owners. You must follow the Arm’s trademark usage guidelines
http://www.arm.com/company/policies/trademarks.
Copyright © 2019-2022 Arm Limited (or its affiliates). All rights reserved.
ii Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
(LES-PRE-20349 version 21.0)
In this document, where the term Arm is used to refer to the company it means “Arm or any of its affiliates as appropriate”.
Note
• The term Arm can refer to versions of the Arm architecture, for example Armv8 refers to version 8 of the Arm architecture.
The context makes it clear when the term is used in this way.
• This document describes only the Armv8-R AArch64 architecture profile. For the behaviors required by the Armv8-A
architecture, see the Arm® Architecture Reference Manual Armv8, for Armv8-A architecture profile.
Confidentiality Status
This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in
accordance with the terms of the agreement entered into by Arm and the party that Arm delivered this document to.
Product Status
The information in this manual is at EAC quality, which means that all features of the specification are described in the manual.
Web Address
http://www.arm.com
This issue of the Arm® Architecture Reference Manual Supplement Armv8, for Armv8-R AArch64 architecture profile contains
many improvements and corrections. Validation of this document has identified the following issues that Arm will address in
future issues:
• The references to LDLAR, LDLARH, and SMC instructions are present in register descriptions.
• In Part I Architectural Pseudocode:
— The functions that address both AArch32 and AArch64 functionality might contain cases, comments, or references
that apply to only AArch32 state, EL3 Exception level, Monitor mode, Non-secure state, or other features that are
not supported in Armv8-R AArch64, and are therefore not applicable to the Armv8-R AArch64 architecture.
— Some functions and comments might contain information that is related to the short-descriptor format that is not
applicable to the Armv8-R AArch64 architecture.
• Assertions that are not applicable to Armv8-R AArch64 might be present.
• Enumerations might contain values that are not applicable to Armv8-R AArch64.
• Tests might contain clauses that always return TRUE or FALSE in AArch64 state and there could be potentially redundant
tests in the Armv8-R AArch64 architecture. For example, in Armv8-R AArch64:
— UsingAArch32() always returns FALSE.
— IsSecure always returns TRUE.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. iii
ID062922 Non-Confidential
iv Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Contents
Arm Architecture Reference Manual Supplement
Armv8, for R-profile AArch64 architecture
Preface
About this supplement ................................................................................................ xii
Using this book .......................................................................................................... xiii
Conventions .............................................................................................................. xv
Additional reading ..................................................................................................... xvi
Feedback ................................................................................................................. xvii
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. vii
ID062922 Non-Confidential
Part C Armv8-R AArch64 Protected Memory System Architec-
ture
Chapter C1 Protected Memory System Architecture
C1.1 About the Protected Memory System Architecture ............................................ C1-36
C1.2 Memory Protection Unit ....................................................................................... C1-37
C1.3 Address translation regimes ................................................................................ C1-38
C1.4 Default memory map ........................................................................................... C1-39
C1.5 Armv8-A memory view ....................................................................................... C1-40
C1.6 MPU memory translations and faults .................................................................. C1-41
C1.7 Protection region attributes and access permissions .......................................... C1-49
C1.8 MPU fault encodings ........................................................................................... C1-53
C1.9 PMSAv8-64 implications for caches .................................................................... C1-54
C1.10 Address tagging and pointer authentication support .......................................... C1-55
C1.11 Security model .................................................................................................... C1-56
C1.12 Virtualization ........................................................................................................ C1-59
viii Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part H Armv8-R AArch64 External Debug Registers
Chapter H1 External Debug Registers Descriptions
H1.1 About the external debug registers ................................................................... H1-270
H1.2 External debug registers ................................................................................... H1-271
Glossary
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ix
ID062922 Non-Confidential
x Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Preface
This preface introduces the Arm® Architecture Reference Manual Supplement Armv8, for Armv8-R AArch64
architecture profile. It contains the following sections:
• About this supplement on page xii.
• Using this book on page xiii.
• Conventions on page xv.
• Additional reading on page xvi.
• Feedback on page xvii.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. xi
ID062922 Non-Confidential
Preface
About this supplement
The supplement must be read with the most recent issue of the Arm® Architecture Reference Manual Armv8, for
Armv8-A architecture profile. Together, that manual and this supplement provide a full description of the Armv8-R
AArch64 architecture.
This manual is organized into parts as described in Using this book on page xiii.
xii Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Preface
Using this book
This book is a supplement to the Arm® Architecture Reference Manual Armv8, for Armv8-A architecture profile,
(ARM DDI 0487), and is intended to be used with it. There might be inconsistencies between this supplement and
the Armv8-A Architecture Reference Manual due to some late-breaking changes. Therefore, the Armv8-A
Architecture Reference Manual is the definitive source of information about Armv8-A.
It is assumed that the reader is familiar with the Armv8-A and Armv8-R architectures.
The information in this book is organized into parts, as described in this section:
Part B, Differences between the Armv8-A AArch64 and the Armv8-R AArch64 Profiles
Chapter B1 Differences between the Armv8-A AArch64 and the Armv8-R AArch64 Profiles
Describes the system level and application level architectural differences between the Armv8-A
AArch64 and the Armv8-R AArch64 profiles.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. xiii
ID062922 Non-Confidential
Preface
Using this book
Glossary
Defines terms used in this document that have a specialized meaning.
Note
Terms that are generally well understood in the microelectronics industry are not included in the Glossary.
xiv Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Preface
Conventions
Conventions
The following sections describe conventions that this book can use:
• Typographic conventions.
• Signals.
• Numbers.
• Pseudocode descriptions.
Typographic conventions
The following table describes the typographic conventions:
Typographic conventions
Style Purpose
bold Denotes signal names, and is used for terms in descriptive lists, where appropriate.
monospace Used for assembler syntax descriptions, pseudocode, and source code examples.
Also used in the main text for instruction mnemonics and for references to other items appearing in assembler
syntax descriptions, pseudocode, and source code examples.
SMALL CAPITALS Used in body text for a few terms that have specific technical meanings, and are included in the Glossary in the
Arm® Architecture Reference Manual Armv8, for Armv8-A architecture profile.
Signals
In general this specification does not define processor signals, but it does include some signal examples and
recommendations.
Signal level The level of an asserted signal depends on whether the signal is active-HIGH or
active-LOW. Asserted means:
• HIGH for active-HIGH signals.
• LOW for active-LOW signals.
Numbers
Numbers are normally written in decimal. Binary numbers are preceded by 0b, and hexadecimal numbers by 0x. In
both cases, the prefix and the associated value are written in a monospace font, for example 0xFFFF0000.
Pseudocode descriptions
This book uses a form of pseudocode to provide precise descriptions of the specified functionality.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. xv
ID062922 Non-Confidential
Preface
Additional reading
Additional reading
This section lists relevant publications from Arm and third parties.
Arm publications
• Arm® Architecture Reference Manual, Armv7-A and Armv7-R edition (ARM DDI 0406).
• Arm® Architecture Reference Manual Armv8, for Armv8-A architecture profile (ARM DDI 0487).
• Arm® CoreSight™ Architecture Specification v3.0 (ARM IHI 0029).
• Arm® Embedded Trace Macrocell Architecture Specification, ETMv4.0 to ETMv4.5 (ARM IHI 0064).
• Arm® Generic Interrupt Controller Architecture Specification, GIC architecture version 3 and version 4
(ARM IHI 0069).
Other publications
• JEDEC Solid State Technology Association, Standard Manufacturer’s Identification Code, JEP106.
xvi Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Preface
Feedback
Feedback
Arm welcomes feedback on its documentation.
Note
Arm tests PDFs only in Adobe Acrobat and Acrobat Reader, and cannot guarantee the appearance or behavior of
any document when viewed with any other PDF reader.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. xvii
ID062922 Non-Confidential
Preface
Feedback
xviii Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part A
Introduction and Architecture Overview
Chapter A1
Architecture Overview
This chapter introduces the Armv8 architecture, the architecture profiles it defines, and the Armv8-R AArch64
profile that this manual defines. It contains the following sections:
• About the Armv8 architecture on page A1-20.
• Architecture profiles on page A1-21.
• The Armv8-R AArch64 architecture profile on page A1-22.
• Architecture extensions on page A1-23.
• Supported extensions in Armv8-R AArch64 on page A1-26.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. A1-19
ID062922 Non-Confidential
Architecture Overview
A1.1 About the Armv8 architecture
Except where the architecture specifies differently, the programmer-visible behavior of an implementation that is
compliant with the Arm architecture must be the same as a simple sequential execution of the program on the PE.
This programmer-visible behavior does not include the execution time of the program.
The Arm Architecture Reference Manual also describes rules for software to use the PE.
• Associated trace architectures, which define trace macrocells that implementers can implement with the
associated processor hardware.
The Arm architecture is a Reduced Instruction Set Computer (RISC) architecture with the following RISC
architecture features:
• A load/store architecture, where data-processing operations only operate on register contents, not directly on
memory contents.
• Simple addressing modes, with all load/store addresses determined from register contents and instruction
fields only.
The architecture defines the interaction of the PE with memory, including caches, and includes a memory translation
system. It also describes how multiple PEs interact with each other and with other observers in a system. This
document defines the Armv8-R AArch64 architecture profile. See The Armv8-R AArch64 architecture profile on
page A1-22 for more information.
The Arm architecture supports implementations across a wide range of performance points. Implementation size,
performance, and low power consumption are key attributes of the Arm architecture.
See Conventions on page xv for information about conventions used in this manual, including the use of SMALL
CAPS for particular terms that have Arm-specific meanings that are defined in the Glossary.
A1-20 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Architecture Overview
A1.2 Architecture profiles
A Application profile:
• Supports a Virtual Memory System Architecture (VMSA) based on a Memory Management
Unit (MMU).
• Supports the A32, T32, and A64 instruction sets.
R Real-time profile:
• Supports the AArch64 or AArch32 Execution states.
• Supports A64, or A32 and T32 instruction sets.
• Supports a Protected Memory System Architecture (PMSA) based on a Memory Protection
Unit (MPU).
• Supports an optional VMSA based on an MMU.
M Microcontroller profile:
• Implements a programmers’ model that is designed for low-latency interrupt processing, with
hardware stacking of registers and support for writing interrupt handlers in high-level
languages.
• Supports a PMSA based on an MPU.
• Supports a variant of the T32 instruction set.
For more information, see Introduction to the Armv8 Architecture chapter of the Arm® Architecture Reference
Manual Armv8, for Armv8-A architecture profile.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. A1-21
ID062922 Non-Confidential
Architecture Overview
A1.3 The Armv8-R AArch64 architecture profile
A1-22 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Architecture Overview
A1.4 Architecture extensions
Feature Description
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. A1-23
ID062922 Non-Confidential
Architecture Overview
A1.4 Architecture extensions
Feature Description
FEAT_FPAC and FEAT_FPACCOMBINE Faulting on AUT* instructions and combined pointer authentication instructions
A1-24 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Architecture Overview
A1.4 Architecture extensions
Feature Description
The Armv8-R AArch64 architecture supports concurrent modification and execution of instructions as defined by
the Armv8-A architecture. FEAT_IDST feature is extended to include MPUIR_EL1 register.
For the architectural features supported by Armv8-R AArch64, whether a feature is mandatory or optional depends
on whether the feature is mandatory or optional in the Armv8.4-A architecture.
In a PMSAv8-64 only implementation, the FEAT_TLBIOS and FEAT_TLBIRANGE features are optional.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. A1-25
ID062922 Non-Confidential
Architecture Overview
A1.5 Supported extensions in Armv8-R AArch64
A1-26 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part B
Differences between the Armv8-A AArch64 and the
Armv8-R AArch64 Profiles
Chapter B1
Differences between the Armv8-A AArch64 and the
Armv8-R AArch64 Profiles
This chapter describes the system level and application level architectural differences between Armv8-R AArch64
and Armv8-A AArch64. It contains the following sections:
• Differences from the Armv8-A AArch64 application level architecture on page B1-30.
• Differences from the Armv8-A AArch64 system level architecture on page B1-31.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. B1-29
ID062922 Non-Confidential
Differences between the Armv8-A AArch64 and the Armv8-R AArch64 Profiles
B1.1 Differences from the Armv8-A AArch64 application level architecture
B1.1.1 Differences from the Armv8-A AArch64 application level programmers’ model
The Armv8-R AArch64 application level programmers’ model differs from the Armv8-A AArch64 profile in the
following ways:
• Armv8-R AArch64 supports only a single Security state, Secure.
• EL2 is mandatory.
• EL3 is not supported.
• Armv8-R AArch64 supports the A64 ISA instruction set with some modifications.
See The AArch64 Application Level Programmers’ Model chapter of the Arm® Architecture Reference Manual
Armv8, for Armv8-A architecture profile.
B1.1.2 Differences from the Armv8-A AArch64 application level memory model
Armv8-R AArch64 redefines DMB and DSB, and adds an instruction, DFB.
B1-30 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Differences between the Armv8-A AArch64 and the Armv8-R AArch64 Profiles
B1.2 Differences from the Armv8-A AArch64 system level architecture
B1.2.3 Differences from the Armv8-A AArch64 system level programmers’ model
Virtualization
Armv8-R AArch64 provides a PMSA-based virtualization model.
B1.2.4 Differences from the Armv8-A AArch64 system level memory model
Address space
Armv8-R AArch64 can support address bits up to 52 if FEAT_LPA is enabled, otherwise 48 bits.
Address translation
In PMSAv8-64, address translation flat-maps the virtual address (VA), used by the PE, to the physical address (PA),
and determines the access permissions and memory attributes of the target PA.
Optional VMSAv8-64
Armv8-R AArch64 supports VMSAv8-64 as an optional memory system architecture at stage 1 of the Secure
EL1&0 translation regime.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. B1-31
ID062922 Non-Confidential
Differences between the Armv8-A AArch64 and the Armv8-R AArch64 Profiles
B1.2 Differences from the Armv8-A AArch64 system level architecture
B1-32 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part C
Armv8-R AArch64 Protected Memory System
Architecture
Chapter C1
Protected Memory System Architecture
This chapter provides a system-level view of the Protected Memory System Architecture for any implementation
that is compliant with the Armv8-R AArch64 architecture. It contains the following sections:
• About the Protected Memory System Architecture on page C1-36.
• Memory Protection Unit on page C1-37.
• Address translation regimes on page C1-38.
• Default memory map on page C1-39.
• Armv8-A memory view on page C1-40.
• MPU memory translations and faults on page C1-41.
• Protection region attributes and access permissions on page C1-49.
• MPU fault encodings on page C1-53.
• PMSAv8-64 implications for caches on page C1-54.
• Address tagging and pointer authentication support on page C1-55.
• Security model on page C1-56.
• Virtualization on page C1-59.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-35
ID062922 Non-Confidential
Protected Memory System Architecture
C1.1 About the Protected Memory System Architecture
The PMSAv8-64:
• Supports a unified memory protection scheme where an MPU manages instruction and data access. It does
not provide separate instruction protection regions and data protection regions in the address map.
• Defines MPU faults that are consistent with VMSAv8-64 fault definitions and reuses IFSC and DFSC fault
encodings.
• Does not support virtual addressing and flat maps input address to output address.
For general information about the Arm memory model, see The AArch64 Application Level Memory Model and The
AArch64 System Level Memory Model chapters of the Arm® Architecture Reference Manual Armv8, for Armv8-A
architecture profile.
Protection regions:
• Are defined by a pair of registers, a Base Address Register, and a Limit Address Register, see Memory
Protection Unit on page C1-37.
• Have a minimum size of 64 bytes.
• Have a maximum size of the entire address map.
• Must not overlap.
The definition of a protection region specifies the start and the end of the region, the access permissions, and the
memory attributes for the region.
C1-36 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.2 Memory Protection Unit
EL1 MPU
The EL1 MPU can be configured from EL1 or EL2. The EL1 MPU controls the stage 1 of the Secure
EL1&0 translation regime that defines the protection regions for accesses from EL1 and EL0. The
PMSAv8-64 uses SCTLR_EL1.M to enable and disable the EL1 MPU. The EL1 MPU also supports
a Background region, controlled by SCTLR_EL1.BR.
EL2 MPU
The EL2 MPU can be configured only from EL2. The EL2 MPU controls:
• Stage 1 of the Secure EL2 translation regime that defines the protection regions for accesses
from EL2.
• Stage 2 of the Secure EL1 &0 translation regime that defines the protection regions for
accesses from EL1 and EL0.
The PMSAv8-64 uses SCTLR_EL2.M to enable and disable the EL2 MPU. The EL2 MPU also
supports a Background region, controlled by SCTLR_EL2.BR.
Note
When HCR_EL2.VM is 1 and SCTLR_EL2.M is 1, then EL2 MPU modifies the access permissions
and memory attributes that are assigned by the EL1 MPU.
See Protection region attributes and access permissions on page C1-49. PMSAv8-64 supports a default memory
map as a Background region for memory region checks at both EL1 and EL2. See Default memory map on
page C1-39.
For more information, see chapter AArch64 System Register Descriptions of the Arm® Architecture Reference
Manual Armv8, for Armv8-A architecture profile.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-37
ID062922 Non-Confidential
Protected Memory System Architecture
C1.3 Address translation regimes
C1-38 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.4 Default memory map
The default memory map of the Armv8-R AArch64 architecture is IMPLEMENTATION DEFINED. Therefore, the
Armv8-R AArch64 architecture defines only the condition to access the default memory map, but not the memory
map itself. The memory attributes, access permissions, and Security state of the memory regions in the default
memory map are also IMPLEMENTATION DEFINED.
Any access outside the implemented physical address range in the default memory map results in a fault.
If the IMPLEMENTATION DEFINED default memory map is discontinuous, then the implementation must also define
a generic permission and attribute to be used for memory access to all memory regions that are not covered by the
default memory map. However, an implementation can also select a default memory map so that the accesses to
these discontinuous memory regions, where no memory attributes are allocated, always result in memory faults.
Note
The default memory map is same for EL1 and EL2 MPUs.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-39
ID062922 Non-Confidential
Protected Memory System Architecture
C1.5 Armv8-A memory view
If the MPU and the Background region are not enabled for stage 1 translation, then PMSAv8-64 uses the same
memory attributes as defined by VMSAv8-64 when stage 1 translation is disabled.
C1-40 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.6 MPU memory translations and faults
For the EL1 MPU memory translations, this section describes the following:
• Stage 1 EL1&0 memory attributes.
• Stage 1 MPU faults for EL1 access.
• Stage 1 MPU faults for EL0 access.
• EL1 MPU fault types.
• MPU fault check sequence for the stage 1 Secure EL1&0 translation.
For the EL2 MPU memory translations, this section describes the following:
• Stage 1 EL2 memory attributes.
• Stage 1 MPU faults for EL2 access.
• Stage 2 EL1&0 memory attributes.
• Stage 2 EL1&0 MPU faults.
• EL2 MPU fault types.
• MPU fault check sequence for the stage 1 Secure EL2 translation.
• MPU fault check sequence for the stage 2 Secure EL1&0 translation.
HCR_EL2 SCTLR_EL1
MPU hit Memory attribute
DC M BR
1 x x - Default Cacheability
Note
Armv8-A AArch64 memory view is the stage 1 memory attribute defined by the Armv8-A architecture for
accessing a memory location when stage 1 address translation is disabled (SCTLR_ELx.M = 0).
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-41
ID062922 Non-Confidential
Protected Memory System Architecture
C1.6 MPU memory translations and faults
Table C1-2 lists the configurations for the stage 1 MPU faults for EL1 access.
HCR_EL2 SCTLR_EL1
MPU hit MPU faults
DC M BR
0 1 0 No Translation fault
Table C1-3 lists the configurations for the stage 1 MPU faults for EL0 access.
HCR_EL2 SCTLR_EL1
MPU hit MPU faults
DC M BR
0 1 x No Translation fault
Note
If HCR_EL2.{DC, TGE} is not {0, 0}, then the PE behaves as if the value of the SCTLR_EL1.BR is 0 for all
purposes other than returning the value of a direct read of the field.
C1-42 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.6 MPU memory translations and faults
Based on MPU protection region checks, the EL1 MPU can raise the following responses as described in
Table C1-4.
Allowed Valid
If the EL1 MPU is disabled and the input address is larger than the implemented PA size, then a level 0 address size
fault is generated. If the EL1 MPU is enabled and the input address is larger than the implemented PA size, then a
level 0 translation fault is generated. Permitted transactions are then presented to stage 2 permission checks by the
EL2 MPU.
Depending on the configuration in the PMSAv8-64 registers, the memory attributes of an address can be defined by
an MPU protection region, a Background region, or it may have Armv8-A AArch64 memory view.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-43
ID062922 Non-Confidential
Protected Memory System Architecture
C1.6 MPU memory translations and faults
C1.6.3 MPU fault check for the stage 1 Secure EL1&0 translation
Figure C1-1 shows the MPU fault check sequence for the stage 1 of the Secure EL1&0 translation regime.
Memory address
Alignment Y
Check address alignment
check required?
N
Y N
Aligned? Alignment fault
Y Is Default
Cacheability
enabled?
N
MPU Y
Check for MPU region match
enabled?
N
Use Default Cacheability attributes Y Multiple N
Matched?
N Matches?
Background
region enabled? N Y
Y
Y
EL0 access?
Use v8-A AArch64 memory
view N
Y Background N
Use default memory map Translation fault
region enabled?
N
Valid attributes?
N
Valid permission? Permission fault
N address < Y
Address size fault implemented PA Proceed to Stage 2
range
Figure C1-1 MPU fault check sequence for the stage 1 Secure EL1&0 translation
C1-44 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.6 MPU memory translations and faults
SCTLR_EL2
MPU hit Memory attributes
M BR
Table C1-6 lists the configurations for stage 1 MPU faults for EL2 access.
SCTLR_EL2
MPU hit MPU faults
M BR
1 0 No Translation fault
Based on HCR_EL2.VM and SCTLR_EL2.{M, BR}, the stage 2 of the Secure EL1&0 translation regime can have
the following configurations for memory attributes, as described in Table C1-7.
HCR_EL2 SCTLR_EL2
MPU hit Memory attribute
VM M BR
1 0 0 - CONSTRAINED UNPREDICTABLE
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-45
ID062922 Non-Confidential
Protected Memory System Architecture
C1.6 MPU memory translations and faults
Table C1-8 lists the configurations for MPU faults for the stage 2 of the Secure EL1&0 translation regime.
HCR_EL2 SCTLR_EL2
MPU hit MPU faults
VM M BR
0 x x - No Fault
1 0 0 - CONSTRAINED UNPREDICTABLE
1 1 x No Translation fault
1 1 x Yes No Fault, or Permission fault, or Translation fault due to Secure Check, if enabled.
There are no separate configurations for the protection regions for the stage 1 of the Secure EL2 and the stage 2 of
the Secure EL1&0 translations. Memory accesses for both translations are controlled by the same MPU
configuration registers, PRBAR_EL2 and PRLAR_EL2.
Note
In Armv8-A, there are separate translation table base registers for the stage 1 of the Secure EL2 and the stage 2 of
the Secure EL1&0 translation regimes.
Based on MPU protection region checks, the EL2 MPU can raise the following responses as described in
Table C1-9.
If the EL2 MPU is disabled for the stage 1 of the Secure EL2 translation regime, then any access to an address
outside the implemented PA range raises a level 0 address size fault. If the EL2 MPU is enabled for the stage 1 of
the Secure EL2 translation regime, and the input address is larger than the implemented PA range, then a level 0
translation fault is generated.
C1-46 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.6 MPU memory translations and faults
C1.6.6 MPU fault check for the stage 1 Secure EL2 translation
Figure C1-2 shows the MPU fault check sequence for the stage 1 of the Secure EL2 translation regime.
Memory address
Alignment Y
Check address alignment
check required?
N
Y N
Aligned? Alignment fault
Y Background N
Use default memory map Translation fault
region enabled?
N
Valid attributes?
N
Valid permission? Permission fault
address < Y
N
Address size fault implemented PA Output address
range
Figure C1-2 MPU fault check sequence for the stage 1 Secure EL2 translation
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-47
ID062922 Non-Confidential
Protected Memory System Architecture
C1.6 MPU memory translations and faults
C1.6.7 MPU fault check for the stage 2 Secure EL1&0 translation
Figure C1-3 shows the MPU fault check sequence for the stage 2 of the Secure EL1&0 translation regime.
Memory address
N Stage-2
Translation
Enabled?
Y
Y
MPU Enabled? Check for MPU Region Match
N
No stage-2 translation
Y
Matched?
N Background
Region Enabled? N
Y
CONSTRAINED
UNPREDICTABLE
N Y Multiple
Valid Attributes? Translation Fault
Matches?
Y N
SecureCheck N
Enabled?
N
NS matched? Translation Fault
N
Valid Permission? Permission Fault
Y
address <
Y
implemented
PA range
N Output Address
Figure C1-3 MPU fault check sequence for the stage 2 Secure EL1&0 translation
C1-48 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.7 Protection region attributes and access permissions
The memory attributes and access permissions for a protection region are defined by:
• The PRBAR_EL1 and PRLAR_EL1 registers, or the PRBAR_EL2 and PRLAR_EL2 registers that define
the protection region.
• The MAIR_EL1.Attr<n> or MAIR_EL2.Attr<n> field that is indexed by PRLAR_EL1.AttrIndx or
PRLAR_EL2.AttrIndx, respectively.
See also Memory attributes and access permission mappings on page C1-51.
For the Secure EL1&0 translation regime, when HCR_EL2.VM is 1, the stage 1 memory attribute and access
permission assignments are combined with the stage 2 assignments, as described in Combining memory attributes
and access permissions on page C1-51.
Note
Writes to MPU registers are only guaranteed to be visible following a Context synchronization event and DSB
operation.
If there are multiple protection regions allocated to the same coherency granule, then Armv8-R AArch64 follows
the Armv8-A mismatched memory attributes rules to access any byte within that coherency granule. If the Security
states of protection regions are different, then implementation must ensure that these regions are not allocated to the
same coherency granule.
The PMSAv8-64 uses the same memory attributes defined by the VMSAv8-64 using MAIR_EL1 and MAIR_EL2
for the stage 1 EL1&0 and EL2 translations. For the stage 2 EL1&0 translations, memory attributes encoding in the
MAIR_EL2 register is defined in Table C1-10.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-49
ID062922 Non-Confidential
Protected Memory System Architecture
C1.7 Protection region attributes and access permissions
When Attr[7:4] is 0b0000, Attr[3:0] defines the type of Device memory. In this case, Attr[1:0] != 0b00 gives
UNPREDICTABLE behavior as defined by Armv8-A. Table C1-11 describes the meaning of Attr<3.0> when Attr[7:4]
is 0b0000.
00 00 Device-nGnRnE
01 00 Device-nGnRE
10 00 Device-nGRE
11 00 Device-GRE
When Attr[7:4] is not 0b0000, Attr[3:0] defines the Inner Cache Policy, and Attr[3:0] = 0b0000 gives UNPREDICTABLE
behavior as defined by Armv8-A. Table C1-12 describes the meaning of Attr<3.0> when Attr[7:4] is not 0b0000.
For more information, see chapter The AArch64 Virtual Memory System Architecture of the Arm® Architecture
Reference Manual Armv8, for Armv8-A architecture profile.
Access granted in the stage 1 of the Secure EL1&0 translation regime by the EL1 MPU is subject to further
qualification by the EL2 MPU in the stage 2 of the Secure EL1&0 translation regime.
The AP, XN, and NS bits in PMSAv8-64 are interpreted in the same way as defined by VMSAv8-64. For selecting
memory attributes and defining access permissions, PMSAv8-64 follows the same prioritization rules defined by
VMSAv8-64 in Armv8-A.
PMSAv8-64 does not support hierarchical control bits defined in the VMSAv8-64 table descriptors. PMSAv8-64
also does not support Privileged execute-never (PXN) and Unprivileged execute-never (UXN) bits. PMSAv8-64
behaves as PXN = XN and UXN = XN, and follows the same rule defined by VMSAv8-64 in combining permission
attributes.
If the value of SCTLR_EL1.{M, BR} is {0, 1}, then for the Secure EL1&0 translation regime, any memory region
that is writable at EL0, is also executable from EL1 if that address is marked as executable by the Background
region.
Armv8-R AArch64 supports FEAT_PAN as defined by the Armv8-A architecture. If the value of SCTLR_EL1.M
is 1, FEAT_PAN is applied to the stage 1 of the Secure EL1&0 translation regime.
C1-50 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.7 Protection region attributes and access permissions
Non-secure (NS) PRLAR_EL1.NS Specifies whether the translated address is in the Secure or Non-secure
PRLAR_EL2.NS address space.
Access Permission (AP) PRBAR_EL1.AP Defines the Access permissions for the protection region.
PRBAR_EL2.AP
Execute Never (XN) PRBAR_EL1.XN Defines the Execute-never attribute for the protection region.
PRBAR_EL2.XN
Shareability (SH) PRBAR_EL1.SH Defines the Shareability for a Normal memory region. For any type of
PRBAR_EL2.SH Device memory or Normal Non-cacheable memory, the value of the
SH[1:0] field is IGNORED.
Attribute Index (AttrIndx) PRLAR_EL1.AttrIndx Indexes an Attr<n> field in the MAIR_EL1 or MAIR_EL2 register,
PRLAR_EL2.AttrIndx which gives the memory type and memory attributes.
Note
In Armv8-A, the memory attribute encoding that enables FEAT_S2FWB is MemAttr[4:2] = 0b110 in stage 2 block
or page descriptor of the Secure EL1&0 translation regime, while in Armv8-R AArch64, it is MAIR_EL2.Attr[7:6]
= 0b11. Therefore, FEAT_S2FWB architecture rules defined for the 0b110 encoding in Armv8-A must be applied to
the 0b11 encoding in Armv8-R AArch64.
For more information, see the Stage 2 memory region type and Cacheability attributes when Armv8.4-S2FWB is
implemented section of the Arm® Architecture Reference Manual Armv8, for Armv8-A architecture profile.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-51
ID062922 Non-Confidential
Protected Memory System Architecture
C1.7 Protection region attributes and access permissions
For the Secure EL2 translation regime if SCTLR_EL2.{M, BR} is {0, 0}, then translation is disabled.
C1-52 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.8 MPU fault encodings
Translation fault Translation fault, level 0 Invalid input address. There is no valid mapping or
valid memory attributes for the input address.
Address size fault Address size fault, level 0 Generated output address is out of range of the
implemented physical address.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-53
ID062922 Non-Confidential
Protected Memory System Architecture
C1.9 PMSAv8-64 implications for caches
C1-54 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.10 Address tagging and pointer authentication support
The Armv8-R AArch64 architecture supports FEAT_PAuth2 feature defined in Armv8-A architecture with a
modified definition of PAC field as described below:
• When Address tagging is used, the PAC field is Xn[54:bottom_PAC_bit].
• When Address tagging is not used, the PAC field is Xn[63:56, 54:bottom_PAC_bit].
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-55
ID062922 Non-Confidential
Protected Memory System Architecture
C1.11 Security model
The NS bit in the PRLAR_EL1 and PRLAR_EL2 specifies whether the output address is in the Secure or
Non-secure address space. Each protection region can be independently configured to the Secure or Non-secure
address space.
The configuration bits required to implement Secure and Non-secure states in VMSAv8-64 are mapped to
PMSAv8-64 as described in Table C1-15.
VMSAv8-64 PMSAv8-64
VSTCR_EL2.SW NA
VSTCR_EL2.SA VSTCR_EL2.SA
VTCR_EL2.NSW NA
VTCR_EL2.NSA VTCR_EL2.NSA
See also
C1-56 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.11 Security model
In addition, VSTCR_EL2.SA and VTCR_EL2.NSA controls are also supported and have the same functionality as
FEAT_SEL2 but are applied to PA in the Secure EL1&0 translation regime.
VSTCR_EL2.SC has no effect on the Secure EL2 translation regime. Table C1-16 describes the behavior of
VSTCR_EL2.SC for the Secure EL1&0 translation regime.
Table C1-16 Secure check behavior in the Secure EL1&0 translation regime
EL1 and EL0 access is further subjected to VSTCR_EL2.SA and VTCR_EL2.NSA controls as defined by
Armv8.4-A.
Table C1-17 describes the behavior of VSTCR_EL2.SA and VTCR_EL2.NSA in the Secure EL1&0 translation
regime.
Table C1-17 VSTCR_EL2.SA and VTCR_EL2.NSA behavior in the Secure EL1&0 translation
regime
0 0 x 0
0 1 Behaves as 1 1
1 0 0 0
1 0 1 1
1 1 x 1
The Armv8-R AArch64 architecture follows the Armv8-A architecture rules on whether VSTCR_EL2.SA and
VTCR_EL2.NSA controls should be applied.
• If HCR_EL2.VM=1 and SCTLR_EL2.M=1 or SCTLR_EL2.BR=1, then stage 2 Secure EL1&0 translation
is enabled.
• If HCR_EL2.VM=0, then stage 2 Secure EL1&0 translation is disabled.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-57
ID062922 Non-Confidential
Protected Memory System Architecture
C1.11 Security model
C1-58 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Protected Memory System Architecture
C1.12 Virtualization
C1.12 Virtualization
Armv8-R AArch64 implements a permission-based containerization by introducing a stage 2 translation using an
MPU controlled by a hypervisor running at EL2. The MPU does not perform address mapping and only checks
permissions. Therefore, Armv8-R AArch64 relies on hypervisor configured permission attributes of the memory
region to implement containerization.
For more information, see chapter The AArch64 System Level Programmers’ Model of the Arm® Architecture
Reference Manual Armv8, for Armv8-A architecture profile.
If multiple PMSAv8-64 guests are present, then these guests must be configured to use non-conflicting physical
memory addresses. Virtualization is supported by the EL2 MPU at stage 2 of the Secure EL1&0 translation regime.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. C1-59
ID062922 Non-Confidential
Protected Memory System Architecture
C1.12 Virtualization
C1-60 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part D
Armv8-R AArch64 Virtual Memory System Architecture
Chapter D1
Virtual Memory System Architecture
This chapter provides a system-level view of the Virtual Memory System Architecture (VMSAv8-64) for any
implementation that is compliant with the Armv8-R AArch64 architecture. It contains the following sections:
• About the Virtual Memory System Architecture on page D1-64.
• Architecture extensions in VMSAv8-64 on page D1-65.
• Support for VMSAv8-64 in Armv8-R AArch64 on page D1-66.
• System registers access control on page D1-67.
• Virtualization on page D1-68.
• System operations on page D1-69.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. D1-63
ID062922 Non-Confidential
Virtual Memory System Architecture
D1.1 About the Virtual Memory System Architecture
VMSAv8-64 provides a Memory Management Unit (MMU) that controls address translation, access permissions,
and memory attribute determination and checking, for memory accesses made by the PE. The process of address
translation maps the virtual addresses (VAs) used by the PE onto the physical addresses (PAs) of the physical
memory system.
Armv8-R AArch64 supports VMSAv8-64 as an optional memory system architecture at stage 1 of the Secure
EL1&0 translation regime, and supports general purpose operating systems, such as Linux and Android at EL1.
With VMSAv8-64 supported at EL1, the Armv8-R AArch64 architecture profile can have the following memory
system configurations:
• PMSAv8-64 at EL1 and EL2.
• PMSAv8-64 or VMSAv8-64 at EL1, and PMSAv8-64 at EL2.
For more information, see The AArch64 Virtual Memory System Architecture chapter of the Arm® Architecture
Reference Manual Armv8, for Armv8-A architecture profile.
D1-64 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Virtual Memory System Architecture
D1.2 Architecture extensions in VMSAv8-64
Feature Description
Control fields for the architecture features, which are RES0 in some contexts if the value of VTCR_EL2.MSA = 0,
are treated as RES0 in all contexts if an implementation does not support VMSAv8-64. For the architectural features
supported by Armv8-R AArch64, whether a feature is mandatory or optional depends on whether the feature is
mandatory or optional in the Armv8.4-A architecture.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. D1-65
ID062922 Non-Confidential
Virtual Memory System Architecture
D1.3 Support for VMSAv8-64 in Armv8-R AArch64
In Armv8-R AArch64, the only permitted value for ID_AA64MMFR0_EL1.MSA is 0b1111. When
ID_AA64MMFR0_EL1.MSA_frac is 0b0010, the stage 1 of the Secure EL1&0 translation regime can enable
PMSAv8-64 or VMSAv8-64 architecture.
If PE supports both PMSAv8-64 and VMSAv8-64 at EL1, then VTCR_EL2.MSA determines the memory system
architecture enabled at stage 1 of the Secure EL1&0 translation regime. Depending on the memory system
architecture, the stage 1 of the Secure EL1&0 translation regime is controlled by either an EL1 MPU for
PMSAv8-64, or an MMU for VMSAv8-64.
The stage 2 of the Secure EL1&0 translation regime and the stage 1 of the Secure EL2 translation regime are
controlled by EL2 MPU. Armv8-R AArch64 uses the same translation table format and fault encodings as
Armv8-A.
It is IMPLEMENTATION DEFINED whether a physical location is visible to a VMSAv8-64 context and to page table
accesses, and it is permissible for an implementation to raise an External abort in this case.
For more information, see The AArch64 Virtual Memory System Architecture chapter of the Arm® Architecture
Reference Manual Armv8, for Armv8-A architecture profile.
D1-66 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Virtual Memory System Architecture
D1.4 System registers access control
The following EL1 PMSAv8-64 registers are UNDEFINED from EL1 in a VMSA context:
• MPUIR_EL1.
• PRBAR_EL1.
• PRBAR<n>_EL1.
• PRLAR_EL1.
• PRLAR<n>_EL1.
• PRSELR_EL1.
• PRENR_EL1.
Note
TTBR1_EL1 is UNDEFINED from EL1 in a PMSA context. If an implementation supports only PMSAv8-64 at EL1,
then accessing VMSAv8-64 register, TTBR1_EL1, is UNDEFINED from both EL1 and EL2.
Both VMSAv8-64 and PMSAv8-64 registers are accessible from EL2 independent of whether a Guest operating
system at EL1 uses PMSAv8-64 or VMSAv8-64.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. D1-67
ID062922 Non-Confidential
Virtual Memory System Architecture
D1.5 Virtualization
D1.5 Virtualization
For Armv8-R AArch64, the hypervisor running at EL2 selects the memory system architecture for each Guest
operating system by configuring the VTCR_EL2.MSA bit. This enables the hypervisor to support multiple Guest
operating systems utilizing either PMSAv8-64 or VMSAv8-64 on a per guest basis. Memory accesses by both
VMSAv8-64 and PMSAv8-64 guests at EL1 are further validated at stage 2 of the Secure EL1&0 translation regime.
If multiple VMSAv8-64 or PMSAv8-64 guests are present, then these guests must be configured to use
non-conflicting physical memory addresses.
Note
Secure Check control, VSTCR_EL2.SC does not differentiate between translation table walk or memory access.
For more information, see The AArch64 Virtual Memory System Architecture chapter of the Arm® Architecture
Reference Manual Armv8, for Armv8-A architecture profile.
D1-68 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Virtual Memory System Architecture
D1.6 System operations
Stage 1 VMSAv8-64 is permitted to cache stage 2 PMSAv8-64 MPU configuration as a part of the translation
process. Visibility of stage 2 MPU updates for stage 1 VMSAv8-64 contexts requires associated TLB invalidation
for stage 2. The stage 2 TLB invalidation is not required to apply to caching structures that combine stage 1 and
stage 2 attributes.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. D1-69
ID062922 Non-Confidential
Virtual Memory System Architecture
D1.6 System operations
D1-70 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part E
A64 Instruction Set for Armv8-R AArch64
Chapter E1
A64 Instruction Set for Armv8-R AArch64
This chapter describes the instructions in Armv8-R AArch64. It contains the following sections:
• Instruction encodings on page E1-74.
• A64 instructions in Armv8-R AArch64 on page E1-75.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. E1-73
ID062922 Non-Confidential
A64 Instruction Set for Armv8-R AArch64
E1.1 Instruction encodings
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 8 7 5 4 0
1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 CRm op2 Rt
CRm op2 Rt
- 000 - Unallocated
- 111 11111 SB
E1-74 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
A64 Instruction Set for Armv8-R AArch64
E1.2 A64 instructions in Armv8-R AArch64
For more information, see Definition of the Armv8 memory model in the Arm® Architecture Reference Manual
Armv8, for Armv8-A architecture profile.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. E1-75
ID062922 Non-Confidential
A64 Instruction Set for Armv8-R AArch64
E1.2 A64 instructions in Armv8-R AArch64
E1.2.1 DFB
Data Full Barrier is a memory barrier that ensures the completion of memory accesses. If executed at EL2, this
instruction orders memory accesses irrespective of their Exception level or associated VMID. If executed at EL1 or
EL0, this instruction behaves as DSB SY.
• The encodings in this description are named to match the encodings of DSB.
• The description of DSB gives the operational pseudocode for this instruction.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 8 7 6 5 4 3 2 1 0
1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 0 0 1 1 1 1 1
CRm opc
Encoding
DFB
is equivalent to
DSB #12
Operation
The description of DSB gives the operational pseudocode for this instruction.
E1-76 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
A64 Instruction Set for Armv8-R AArch64
E1.2 A64 instructions in Armv8-R AArch64
E1.2.2 DMB
Data Memory Barrier is a memory barrier that ensures the ordering of observations of memory accesses, see Data
Memory Barrier (DMB) in Arm® Architecture Reference Manual Armv8, for Armv8-A architecture profile.
• EL1 and EL0 memory accesses are ordered only with respect to memory accesses using the same VMID.
• EL2 memory accesses are ordered only with respect to other EL2 memory accesses.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 8 7 6 5 4 3 2 1 0
1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 CRm 1 0 1 1 1 1 1 1
opc
Encoding
DMB <option>|#<imm>
MBReqDomain domain;
MBReqTypes types;
case CRm<3:2> of
when '00' domain = MBReqDomain_OuterShareable;
when '01' domain = MBReqDomain_Nonshareable;
when '10' domain = MBReqDomain_InnerShareable;
when '11' domain = MBReqDomain_FullSystem;
case CRm<1:0> of
when '00' types = MBReqTypes_All; domain = MBReqDomain_FullSystem;
when '01' types = MBReqTypes_Reads;
when '10' types = MBReqTypes_Writes;
when '11' types = MBReqTypes_All;
Assembler symbols
<option> Specifies the limitation on the barrier operation. Values are:
SY Full system is the required shareability domain, reads and writes are the required access
types, both before and after the barrier instruction. This option is referred to as the full
system barrier. Encoded as CRm = 0b1111.
ST Full system is the required shareability domain, writes are the required access type, both
before and after the barrier instruction. Encoded as CRm = 0b1110.
LD Full system is the required shareability domain, reads are the required access type before
the barrier instruction, and reads and writes are the required access types after the barrier
instruction. Encoded as CRm = 0b1101.
ISH Inner Shareable is the required shareability domain, reads and writes are the required
access types, both before and after the barrier instruction. Encoded as CRm = 0b1011.
ISHST Inner Shareable is the required shareability domain, writes are the required access type,
both before and after the barrier instruction. Encoded as CRm = 0b1010.
ISHLD Inner Shareable is the required shareability domain, reads are the required access type
before the barrier instruction, and reads and writes are the required access types after the
barrier instruction. Encoded as CRm = 0b1001.
NSH Non-shareable is the required shareability domain, reads and writes are the required
access, both before and after the barrier instruction. Encoded as CRm = 0b0111.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. E1-77
ID062922 Non-Confidential
A64 Instruction Set for Armv8-R AArch64
E1.2 A64 instructions in Armv8-R AArch64
NSHST Non-shareable is the required shareability domain, writes are the required access type,
both before and after the barrier instruction. Encoded as CRm = 0b0110.
NSHLD Non-shareable is the required shareability domain, reads are the required access type
before the barrier instruction, and reads and writes are the required access types after the
barrier instruction. Encoded as CRm = 0b0101.
OSH Outer Shareable is the required shareability domain, reads and writes are the required
access types, both before and after the barrier instruction. Encoded as CRm = 0b0011.
OSHST Outer Shareable is the required shareability domain, writes are the required access type,
both before and after the barrier instruction. Encoded as CRm = 0b0010.
OSHLD Outer Shareable is the required shareability domain, reads are the required access type
before the barrier instruction, and reads and writes are the required access types after the
barrier instruction. Encoded as CRm = 0b0001.
All other encodings of CRm that are not listed above are reserved, and can be encoded using the #<imm>
syntax. All unsupported and reserved options must execute as a full system barrier operation, but
software must not rely on this behavior. For more information on whether an access is before or after
a barrier instruction, see Data Memory Barrier (DMB) in Arm® Architecture Reference Manual
Armv8, for Armv8-A architecture profile or see Data Synchronization Barrier (DSB) in Arm®
Architecture Reference Manual Armv8, for Armv8-A architecture profile.
<imm> Is a 4-bit unsigned immediate, in the range 0 to 15, encoded in the "CRm" field.
Operation
vmid_sensitive = (PSTATE.EL != EL2) && (CRm<1:0> != '00');
DataMemoryBarrier(domain, types, vmid_sensitive);
E1-78 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
A64 Instruction Set for Armv8-R AArch64
E1.2 A64 instructions in Armv8-R AArch64
E1.2.3 DSB
Data Synchronization Barrier is a memory barrier that ensures the completion of memory accesses, see Data
Synchronization Barrier (DSB) in Arm® Architecture Reference Manual Armv8, for Armv8-A architecture profile.
• EL1 and EL0 memory accesses are ordered only with respect to memory accesses using the same VMID.
• EL2 memory accesses are ordered only with respect to other EL2 memory accesses.
This instruction is used by the aliases DFB, PSSBB, and SSBB. See Alias conditions for details of when each alias
is preferred.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 8 7 6 5 4 3 2 1 0
1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 CRm 1 0 0 1 1 1 1 1
opc
Encoding
DSB <option>|#<imm>
MBReqDomain domain;
case CRm<3:2> of
when '00' domain = MBReqDomain_OuterShareable;
when '01' domain = MBReqDomain_Nonshareable;
when '10' domain = MBReqDomain_InnerShareable;
when '11' domain = MBReqDomain_FullSystem;
MBReqTypes types;
case CRm<1:0> of
when '00' types = MBReqTypes_All; domain = MBReqDomain_FullSystem;
when '01' types = MBReqTypes_Reads;
when '10' types = MBReqTypes_Writes;
when '11' types = MBReqTypes_All;
Alias conditions
Assembler symbols
<option> Specifies the limitation on the barrier operation. Values are:
SY Full system is the required shareability domain, reads and writes are the required access
types, both before and after the barrier instruction. This option is referred to as the full
system barrier. Encoded as CRm = 0b1111.
ST Full system is the required shareability domain, writes are the required access type, both
before and after the barrier instruction. Encoded as CRm = 0b1110.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. E1-79
ID062922 Non-Confidential
A64 Instruction Set for Armv8-R AArch64
E1.2 A64 instructions in Armv8-R AArch64
LD Full system is the required shareability domain, reads are the required access type before
the barrier instruction, and reads and writes are the required access types after the barrier
instruction. Encoded as CRm = 0b1101.
ISH Inner Shareable is the required shareability domain, reads and writes are the required
access types, both before and after the barrier instruction. Encoded as CRm = 0b1011.
ISHST Inner Shareable is the required shareability domain, writes are the required access type,
both before and after the barrier instruction. Encoded as CRm = 0b1010.
ISHLD Inner Shareable is the required shareability domain, reads are the required access type
before the barrier instruction, and reads and writes are the required access types after the
barrier instruction. Encoded as CRm = 0b1001.
NSH Non-shareable is the required shareability domain, reads and writes are the required
access, both before and after the barrier instruction. Encoded as CRm = 0b0111.
NSHST Non-shareable is the required shareability domain, writes are the required access type,
both before and after the barrier instruction. Encoded as CRm = 0b0110.
NSHLD Non-shareable is the required shareability domain, reads are the required access type
before the barrier instruction, and reads and writes are the required access types after the
barrier instruction. Encoded as CRm = 0b0101.
OSH Outer Shareable is the required shareability domain, reads and writes are the required
access types, both before and after the barrier instruction. Encoded as CRm = 0b0011.
OSHST Outer Shareable is the required shareability domain, writes are the required access type,
both before and after the barrier instruction. Encoded as CRm = 0b0010.
OSHLD Outer Shareable is the required shareability domain, reads are the required access type
before the barrier instruction, and reads and writes are the required access types after the
barrier instruction. Encoded as CRm = 0b0001.
All other encodings of CRm, other than the values 0b0000 and 0b0100, that are not listed above are
reserved, and can be encoded using the #<imm> syntax. All unsupported and reserved options must
execute as a full system barrier operation, but software must not rely on this behavior. For more
information on whether an access is before or after a barrier instruction, see Data Memory Barrier
(DMB) in Arm® Architecture Reference Manual Armv8, for Armv8-A architecture profile or see
Data Synchronization Barrier (DSB) in Arm® Architecture Reference Manual Armv8, for Armv8-A
architecture profile.
Note
The value 0b0000 is used to encode SSBB and the value 0b0100 is used to encode PSSBB.
<imm> Is a 4-bit unsigned immediate, in the range 0 to 15, encoded in the "CRm" field.
Operation
vmid_sensitive = (PSTATE.EL != EL2) && (CRm<1:0> != '00');
DataSynchronizationBarrier(domain, types, vmid_sensitive);
E1-80 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part F
The A64 System Instructions
Chapter F1
The A64 System Instructions
This chapter describes the A64 System instruction class, and the System instruction class encoding space, that is a
subset of the System registers encoding space. It contains the following section:
• System instructions on page F1-84.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. F1-83
ID062922 Non-Confidential
The A64 System Instructions
F1.1 System instructions
For more information, see A64 Instruction Set Overview and The A64 System Instruction Class chapters of the Arm®
Architecture Reference Manual Armv8, for Armv8-A architecture profile.
F1-84 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part G
Armv8-R AArch64 System Registers
Chapter G1
System Registers in a PMSA Implementation
This chapter describes the system control registers in a PMSA implementation. The registers are described in
alphabetical order. It contains the following sections:
• System register groups on page G1-88.
• Accessing MPU memory region registers on page G1-91.
• General system control registers on page G1-92.
• Debug registers on page G1-232.
• Performance Monitors registers on page G1-249.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-87
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.1 System register groups
Register Description
Register Description
G1-88 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.1 System register groups
Register Description
Note
In PMSAv8-64, only level 0 Permission faults are supported in ESR_ELx.{IFSC, DFSC} and PAR_EL1.FST.
Register Description
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-89
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.1 System register groups
Table G1-4 lists the Armv8-A System registers that are not supported in Armv8-R AArch64.
Table G1-4 Alphabetical index of System registers that are not supported in Armv8-R AArch64
Register Description
Note
The exceptions caused by an EL1 register access being UNDEFINEDis at priority level 18. Hence, any exception taken
to EL2 because of HCR_EL2.{TID1, TVM, TRVM} trap controls, has higher priority, priority level 16. The
VSCTLR_EL2 register reuses the encoding of TTBR0_EL2 in Armv8-A.
Table G1-5 disambiguates the general names of the PMSA memory region registers used in this chapter.
G1-90 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.2 Accessing MPU memory region registers
The MPU provides two register interfaces to program the MPU regions:
• Access to any of the MPU regions via PRSELR_ELx, PRBAR<n>_ELx, and PRLAR<n>_ELx.
• Access to MPU regions at offsets from the aligned value of PRSELR_ELx.REGION via PRBAR_ELx and
PRLAR_ELx.
When n=0, the encoding of PRBAR<n>_ELx and PRLAR<n>_ELx corresponds to PRBAR_ELx and
PRLAR_ELx respectively.
When n != 0, then the encoding of PRBAR<n>_ELx and PRLAR<n>_ELx corresponds to the configuration of m-th
MPU region:
m = r: n
Access to MPU region registers beyond the number of implemented regions is CONSTRAINED UNPREDICTABLE. The
value of n can be between 0 and 15 and is encoded using the CRm and op2 fields.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-91
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
G1-92 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Controls access to trace, and Advanced SIMD and floating-point functionality.
Configurations
When EL2 is implemented and enabled in the current Security state and HCR_EL2.{E2H, TGE}
== {1, 1}, the fields in this register have no effect on execution at EL0 and EL1. In this case, the
controls provided by CPTR_EL2 are used.
Attributes
CPACR_EL1 is a 64-bit register.
Field descriptions
63 32
RES0
31 29 28 27 22 21 20 19 0
TTA
Bits [63:29]
Reserved, RES0.
Note
• The ETMv4 architecture does not permit EL0 to access the trace registers. If the trace unit
implements FEAT_ETMv4, EL0 accesses to the trace registers are UNDEFINED, and any
resulting exception is higher priority than an exception that would be generated because the
value of CPACR_EL1.TTA is 1.
• The Armv8-A architecture does not provide traps on trace register accesses through the
optional memory-mapped interface.
System register accesses to the trace registers can have side-effects. When a System register access
is trapped, any side-effects that are normally associated with the access do not occur before the
exception is taken.
If System register access to the trace functionality is not implemented, this bit is RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-93
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [27:22]
Reserved, RES0.
Note
• Attempts to write to the FPSID count as use of the registers for accesses from EL1 or higher.
• Accesses from EL0 to FPSID, MVFR0, MVFR1, MVFR2, and FPEXC are UNDEFINED, and
any resulting exception is higher priority than an exception that would be generated because
the value of CPACR_EL1.FPEN is not 0b11.
Bits [19:0]
Reserved, RES0.
Accessing CPACR_EL1
When HCR_EL2.E2H is 1, without explicit synchronization, access from EL3 using the mnemonic CPACR_EL1
or CPACR_EL12 are not guaranteed to be ordered with respect to accesses using the other mnemonic.
Accesses to this register use the following encodings in the System register encoding space:
G1-94 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
else
X[t, 64] = CPACR_EL1;
elsif PSTATE.EL == EL2 then
X[t, 64] = CPACR_EL1;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-95
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Controls trapping to EL2 of accesses to CPACR, CPACR_EL1, trace, Activity Monitor, and
Advanced SIMD and floating-point functionality.
Configurations
If EL2 is not implemented, this register is RES0 from EL3.
This register has no effect if EL2 is not enabled in the current Security state.
Attributes
CPTR_EL2 is a 64-bit register.
Field descriptions
63 32
RES0
31 30 21 20 19 14 13 12 11 10 9 0
Bits [63:32]
Reserved, RES0.
Note
CPACR_EL1 and CPACR are not accessible at EL0.
Bits [30:21]
Reserved, RES0.
G1-96 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
0b1 Any attempt at EL0, EL1, or EL2, to execute a System register access to an
implemented trace register is trapped to EL2, when EL2 is enabled in the current
Security state, unless it is trapped by CPACR.TRCDIS or CPACR_EL1.TTA.
Note
• The ETMv4 architecture does not permit EL0 to access the trace registers. If the trace unit
implements FEAT_ETMv4, EL0 accesses to the trace registers are UNDEFINED, and any
resulting exception is higher priority than an exception that would be generated because the
value of CPTR_EL2.TTA is 1.
• EL2 does not provide traps on trace register accesses through the optional memory-mapped
interface.
System register accesses to the trace registers can have side-effects. When a System register access
is trapped, any side-effects that are normally associated with the access do not occur before the
exception is taken.
If System register access to the trace functionality is not supported, this bit is RES0.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Bits [19:14]
Reserved, RES0.
Bits [13:12]
Reserved, RES1.
Bit [11]
Reserved, RES0.
Note
FPEXC32_EL2 is not accessible from EL0 using AArch64.
FPSID, MVFR0, MVFR1, and FPEXC are not accessible from EL0 using AArch32.
Bits [9:0]
Reserved, RES1.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-97
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing CPTR_EL2
Accesses to this register use the following encodings in the System register encoding space:
G1-98 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-99
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides configuration controls for virtualization, including defining whether various operations are
trapped to EL2.
Configurations
If EL2 is not implemented, this register is RES0 from EL3.
The bits in this register behave as if they are 0 for all purposes other than direct reads of the register
if EL2 is not enabled in the current Security state.
Attributes
HCR_EL2 is a 64-bit register.
Field descriptions
63 54 53 52 48 47 46 45 42 41 40 39 38 37 36 35 34 33 32
DC BSU FB VI VF VM
Bits [63:54]
Reserved, RES0.
G1-100 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Otherwise:
Reserved, RES0.
Bits [52:48]
Reserved, RES0.
Bits [45:42]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-101
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
If FEAT_PAuth is implemented but EL2 is not implemented or is disabled in the current Security
state, the system behaves as if this bit is 1.
G1-102 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bit [39]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-103
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Otherwise:
Reserved, RES0.
Bits [35:34]
Reserved, RES0.
Note
The behavior is the same irrespective of whether the instruction accesses are to an MPU region or
Background region.
0b0 This control has no effect on stage 2 of the EL1&0 translation regime.
0b1 Forces all stage 2 translations for instruction accesses to Normal memory to be
Non-cacheable.
This bit has no effect on the EL2, EL2&0, or EL3 translation regimes.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, the PE
ignores the value of this field for all purposes other than a direct read of this field.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Note
The behavior is same irrespective of whether the data accesses is to MPU region or Background
region.
0b0 This control has no effect on stage 2 of the EL1&0 translation regime for data accesses
and translation table walks.
0b1 Forces all stage 2 translations for data accesses and translation table walks to Normal
memory to be Non-cacheable.
This bit has no effect on the EL2, EL2&0, or EL3 translation regimes.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, the PE
ignores the value of this field for all purposes other than a direct read of this field.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Bit [31]
Reserved, RAO/WI.
G1-104 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
— If EL1 is in PMSAv8-64 context, the following registers are also trapped to EL2 and
reported using EC syndrome value 0x18 - PRENR_EL1, PRSELR_EL1,
PRBAR_EL1, PRBAR<n>_EL1, PRLAR_EL1, PRLAR<n>_EL1.
0b0 This control does not cause any instructions to be trapped.
0b1 EL1 read accesses to the specified Virtual Memory controls are trapped to EL2, when
EL2 is enabled in the current Security state.
When HCR_EL2.TGE is 1, the PE ignores the value of this field for all purposes other than a direct
read of this field.
Note
EL2 provides a second stage of address translation, that a hypervisor can use to remap the address
map defined by a Guest OS. In addition, a hypervisor can trap attempts by a Guest OS to write to
the registers that control the memory system. A hypervisor might use this trap as part of its
virtualization of memory management.
Note
HVC instructions are always UNDEFINED at EL0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-105
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
• If EL1 is using AArch64, the SCTLR_EL1.M field is treated as being 0 for all
purposes other than returning the result of a direct read of SCTLR_EL1.
• If stage 1 EL1&0 translation regime is in PMSAv8-64 context, the
SCTLR_EL1.BR field is treated as being 0 for all purposes other than returning
the result of a direct read of SCTLR_EL1.
• All virtual interrupts are disabled.
• Any IMPLEMENTATION DEFINED mechanisms for signaling virtual interrupts are
disabled.
• An exception return to EL1 is treated as an illegal exception return.
• The MDCR_EL2.{TDRA, TDOSA, TDA, TDE} fields are treated as being 1 for
all purposes other than returning the result of a direct read of MDCR_EL2.
In addition, when EL2 is enabled in the current Security state, if:
• HCR_EL2.E2H is 0, the Effective values of the HCR_EL2.{FMO, IMO, AMO}
fields are 1.
• HCR_EL2.E2H is 1, the Effective values of the HCR_EL2.{FMO, IMO, AMO}
fields are 0.
For further information on the behavior of this bit when E2H is 1, see 'Behavior of
HCR_EL2.E2H'.
HCR_EL2.TGE must not be cached in a TLB.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
G1-106 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
The TLB maintenance instructions are UNDEFINED at EL0.
• If EL1 is using AArch64 state, the following instructions are trapped to EL2 and reported
with EC syndrome value 0x18:
— IC_IVAU, IC_IALLU, IC_IALLUIS, DC_CVAU.
Note
An exception generated because an instruction is UNDEFINED at EL0 is higher priority than this trap
to EL2. In addition:
• IC_IALLUIS and IC_IALLU are always UNDEFINED at EL0 using AArch64.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-107
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Bit[23]
When FEAT_DPB is implemented:
TPCP
Trap data or unified cache maintenance instructions that operate to the Point of Coherency or
Persistence. Traps execution of those cache maintenance instructions to EL2, when EL2 is enabled
in the current Security state as follows:
• If EL0 is using AArch64 state and the value of SCTLR_EL1.UCI is not 0, the following
instructions are trapped to EL2 and reported using EC syndrome value 0x18:
— DC_CIVAC, DC_CVAC, DC_CVAP. If the value of SCTLR_EL1.UCI is 0 these
instructions are UNDEFINED at EL0 and any resulting exception is higher priority than
this trap to EL2.
• If EL1 is using AArch64 state, the following instructions are trapped to EL2 and reported
using EC syndrome value 0x18:
— DC_IVAC, DC_CIVAC, DC_CVAC, DC_CVAP.
If FEAT_DPB2 is implemented, this trap also applies to DC_CVADP.
Note
• An exception generated because an instruction is UNDEFINED at EL0 is higher priority than
this trap to EL2. In addition:
— AArch64 instructions which invalidate by VA to the Point of Coherency are always
UNDEFINED at EL0 using AArch64.
• In Armv8.0 and Armv8.1, this field is named TPC. From Armv8.2, it is named TPCP.
Note
• An exception generated because an instruction is UNDEFINED at EL0 is higher priority than
this trap to EL2. In addition:
— AArch64 instructions which invalidate by VA to the Point of Coherency are always
UNDEFINED at EL0 using AArch64.
G1-108 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
• In Armv8.0 and Armv8.1, this field is named TPC. From Armv8.2, it is named TPCP.
Note
An exception generated because an instruction is UNDEFINED at EL0 is higher priority than this trap
to EL2, and these instructions are always UNDEFINED at EL0.
Note
ACTLR_EL1 is not accessible at EL0.
The Auxiliary Control Registers are IMPLEMENTATION DEFINED registers that might implement
global control bits for the PE.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-109
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
The trapping of accesses to these registers from EL1 is higher priority than an exception resulting
from the register access being UNDEFINED.
Note
HCR_EL2.TSC traps execution of the SMC instruction. It is not a routing control for the SMC
exception. Trap exceptions and SMC exceptions have different preferred return addresses.
G1-110 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
When HCR_EL2.TGE is 1, the PE ignores the value of this field for all purposes other than a direct
read of this field.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-111
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Bit [15]
Reserved, RES0.
Note
Since a WFE can complete at any time, even without a Wakeup event, the traps on WFE are not
guaranteed to be taken, even if the WFE is executed when there is no Wakeup event. The only
guarantee is that if the instruction does not complete in finite time in the absence of a Wakeup event,
the trap will be taken.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this field
behaves as 0 for all purposes other than a direct read of the value of this bit.
For more information about when WFE instructions can cause the PE to enter a low-power state,
see 'Wait for Event mechanism and Send event'.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
G1-112 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
Since a WFI can complete at any time, even without a Wakeup event, the traps on WFI are not
guaranteed to be taken, even if the WFI is executed when there is no Wakeup event. The only
guarantee is that if the instruction does not complete in finite time in the absence of a Wakeup event,
the trap will be taken.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this field
behaves as 0 for all purposes other than a direct read of the value of this bit.
For more information about when WFI instructions can cause the PE to enter a low-power state, see
'Wait for Interrupt'.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-113
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
G1-114 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-115
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
If EL2 is enabled in the current Security state and the value of HCR_EL2.TGE is 1:
• Regardless of the value of the FMO bit, physical FIQ Interrupts target EL2 unless they are
routed to EL3.
• When FEAT_VHE is not implemented, or if HCR_EL2.E2H is 0, this field behaves as 1 for
all purposes other than a direct read of the value of this bit.
• When FEAT_VHE is implemented and HCR_EL2.E2H is 1, this field behaves as 0 for all
purposes other than a direct read of the value of this bit.
For more information, see 'Asynchronous exception routing'.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
G1-116 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
When the value of this bit is 1, data cache invalidate instructions executed at EL1 perform a data
cache clean and invalidate. For the invalidate by set/way instruction this behavior applies regardless
of the value of the HCR_EL2.SWIO bit.
This bit is permitted to be cached in a TLB.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this field
behaves as 0 for all purposes other than a direct read of the value of this bit.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Accessing HCR_EL2
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-117
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides top level information about the debug system in AArch64 state.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
The external register EDDFR gives information from this register.
Attributes
ID_AA64DFR0_EL1 is a 64-bit register.
Field descriptions
63 44 43 40 39 36 35 32
RES0 RES0
TraceFilt DoubleLock
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
Bits [63:44]
Reserved, RES0.
Bits [35:32]
Reserved, RES0.
G1-118 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [27:24]
Reserved, RES0.
Bits [19:16]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-119
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing ID_AA64DFR0_EL1
Accesses to this register use the following encodings in the System register encoding space:
G1-120 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides information about the instructions implemented in AArch64 state.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
There are no configuration notes.
Attributes
ID_AA64ISAR0_EL1 is a 64-bit register.
Field descriptions
63 60 59 56 55 52 51 48 47 44 43 40 39 36 35 32
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
Bits [63:60]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-121
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
G1-122 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [27:24]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-123
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [3:0]
Reserved, RES0.
Accessing ID_AA64ISAR0_EL1
Accesses to this register use the following encodings in the System register encoding space:
G1-124 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides information about the features and instructions implemented in AArch64 state.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
There are no configuration notes.
Attributes
ID_AA64ISAR1_EL1 is a 64-bit register.
Field descriptions
63 52 51 48 47 44 43 40 39 36 35 32
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
Bits [63:52]
Reserved, RES0.
Bits [47:44]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-125
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [35:32]
Reserved, RES0.
G1-126 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-127
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
If the value of ID_AA64ISAR1_EL1.APA is non-zero, this field must have the value 0b0000.
Accessing ID_AA64ISAR1_EL1
Accesses to this register use the following encodings in the System register encoding space:
G1-128 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-129
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides information about the implemented memory model and memory management support in
AArch64 state.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
There are no configuration notes.
Attributes
ID_AA64MMFR0_EL1 is a 64-bit register.
Field descriptions
63 56 55 52 51 48 47 32
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
BigEndEL0
Bits [63:56]
Reserved, RES0.
Bits [47:32]
Reserved, RES0.
G1-130 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
If EL3 is implemented, the value 0b0000 is not permitted.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-131
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing ID_AA64MMFR0_EL1
Accesses to this register use the following encodings in the System register encoding space:
G1-132 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides information about the implemented memory model and memory management support in
AArch64 state.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
There are no configuration notes.
Attributes
ID_AA64MMFR1_EL1 is a 64-bit register.
Field descriptions
63 52 51 48 47 32
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
Bits [63:52]
Reserved, RES0.
Bits [47:32]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-133
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [19:16]
Reserved, RES0.
G1-134 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [11:8]
Reserved, RES0.
Accessing ID_AA64MMFR1_EL1
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-135
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides information about the implemented memory model and memory management support in
AArch64 state.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
Note
Prior to the introduction of the features described by this register, this register was unnamed and
reserved, RES0 from EL1, EL2, and EL3.
Attributes
ID_AA64MMFR2_EL1 is a 64-bit register.
Field descriptions
63 60 59 56 55 52 51 48 47 44 43 40 39 36 35 32
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
Bits [59:56]
Reserved, RES0.
G1-136 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [47:44]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-137
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [27:24]
Reserved, RES0.
G1-138 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [11:8]
Reserved, RES0.
Accessing ID_AA64MMFR2_EL1
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-139
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides additional information about implemented PE features in AArch64 state.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
The external register EDPFR gives information from this register.
Attributes
ID_AA64PFR0_EL1 is a 64-bit register.
Field descriptions
63 60 59 56 55 52 51 48 47 40 39 36 35 32
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
G1-140 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [55:52]
Reserved, RES0.
Bits [47:40]
Reserved, RES0.
Bits [35:32]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-141
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
When the value of this field is 0b0001, ID_AA64PFR1_EL1.RAS_frac indicates whether
FEAT_RASv1p1 is implemented.
G1-142 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing ID_AA64PFR0_EL1
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-143
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Reserved for future expansion of information about implemented PE features in AArch64 state.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
There are no configuration notes.
Attributes
ID_AA64PFR1_EL1 is a 64-bit register.
Field descriptions
63 36 35 32
RES0
CSV2_frac
31 16 15 12 11 8 7 4 3 0
Bits [63:36]
Reserved, RES0.
G1-144 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [31:16]
Reserved, RES0.
Bits [11:8]
Reserved, RES0.
Bits [3:0]
Reserved, RES0.
Accessing ID_AA64PFR1_EL1
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-145
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
G1-146 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
If VMSAv8-64 is enabled at stage 1 of EL1&0 translation regime, this register provides the memory
attribute encodings corresponding to the possible AttrIndx values in a Long-descriptor format
translation table entry for stage 1 translations at EL1.
If PMSAv8-64 is enabled at stage 1 of EL1&0 translation regime, this register provides the memory
attribute encodings corresponding to the possible AttrIndx values in PRLAR_EL1 register for stage
1 translations.
Configurations
There are no configuration notes.
Attributes
MAIR_EL1 is a 64-bit register.
Field descriptions
63 56 55 48 47 40 39 32
31 24 23 16 15 8 7 0
Attr Meaning
0b0000dd00 Device memory. See encoding of 'dd' for the type of Device memory.
0booooiiii, (oooo != 0000 and iiii != 0000) Normal memory. See encoding of 'oooo' and 'iiii' for the type of Normal Memory.
dd Meaning
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-147
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
dd Meaning
'oooo' Meaning
'iiii' Meaning
R or W Meaning
0b0 No Allocate
0b1 Allocate
Accessing MAIR_EL1
When HCR_EL2.E2H is 1, without explicit synchronization, access from EL3 using the mnemonic MAIR_EL1 or
MAIR_EL12 are not guaranteed to be ordered with respect to accesses using the other mnemonic.
G1-148 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-149
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides the memory attribute encodings corresponding to the possible AttrIndx values in
PRLAR_EL2 for stage 1 EL2 translation regime and for stage 2 EL1&0 translation regime.
For stage 2 EL1&0 translations, the memory attributes are derived from MAIR_EL2 register as
described in the Armv8-R AArch64 architecture.
Configurations
If EL2 is not implemented, this register is RES0 from EL3.
This register has no effect if EL2 is not enabled in the current Security state.
Attributes
MAIR_EL2 is a 64-bit register.
Field descriptions
63 56 55 48 47 40 39 32
31 24 23 16 15 8 7 0
Attr Meaning
0b0000dd00 Device memory. See encoding of 'dd' for the type of Device memory.
0booooiiii, (oooo != 0000 and iiii != 0000) Normal memory. See encoding of 'oooo' and 'iiii' for the type of Normal Memory.
dd Meaning
G1-150 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
'oooo' Meaning
'iiii' Meaning
R or W Meaning
0b0 No Allocate
0b1 Allocate
Accessing MAIR_EL2
When HCR_EL2.E2H is 1, without explicit synchronization, access from EL2 using the mnemonic MAIR_EL2 or
MAIR_EL1 is not guaranteed to be ordered with respect to accesses using the other mnemonic.
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-151
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
G1-152 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
AArch64.SystemAccessTrap(EL2, 0x18);
else
MAIR_EL1 = X[t, 64];
elsif PSTATE.EL == EL2 then
MAIR_EL1 = X[t, 64];
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-153
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Identifies the number of regions supported by the EL1 MPU.
Configurations
There are no configuration notes.
Attributes
MPUIR_EL1 is a 64-bit register.
Field descriptions
63 32
RES0
31 8 7 0
RES0 REGION
Bits [63:8]
Reserved, RES0.
Accessing MPUIR_EL1
Accesses to this register use the following encodings in the System register encoding space:
G1-154 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Identifies the number of regions supported by the EL2 MPU.
Configurations
There are no configuration notes.
Attributes
MPUIR_EL2 is a 64-bit register.
Field descriptions
63 32
RES0
31 8 7 0
RES0 REGION
Bits [63:8]
Reserved, RES0.
Accessing MPUIR_EL2
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-155
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides access to the base addresses for the EL1 MPU region. PRSELR_EL1.REGION determines
which MPU region is selected.
Configurations
All bits above implemented physical address range in this register should be treated as RES0.
Attributes
PRBAR_EL1 is a 64-bit register.
Field descriptions
63 52 51 48 47 32
RES0 BASE[47:6]
BASE[51:48]
31 6 5 4 3 2 1 0
BASE[47:6] XN
SH[1:0] RES0
AP[2:1]
Bits [63:52]
Reserved, RES0.
G1-156 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bit [0]
Reserved, RES0.
Accessing PRBAR_EL1
Any access to MPU region register PRBAR_EL1 above the number of implemented regions specified by
MPUIR_EL1.REGION is CONSTRAINED UNPREDICTABLE.
• Writes to unimplemented PRBAR_EL1 register make all PRBAR_EL1 registers value UNKNOWN.
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-157
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
G1-158 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides access to the base addresses for the EL2 MPU region. PRSELR_EL2.REGION determines
which MPU region is selected.
Configurations
All bits above implemented physical address range in this register should be treated as RES0.
Attributes
PRBAR_EL2 is a 64-bit register.
Field descriptions
63 52 51 48 47 32
RES0 BASE[47:6]
BASE[51:48]
31 6 5 4 3 2 1 0
BASE[47:6] XN
SH[1:0] AP[2:1]
Bits [63:52]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-159
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing PRBAR_EL2
Any access to MPU region register PRBAR_EL2 above the number of implemented regions specified by
MPUIR_EL2.REGION is CONSTRAINED UNPREDICTABLE.
CONSTRAINED UNPREDICTABLE behavior is defined as:
• Writes to unimplemented PRBAR_EL2 register make all PRBAR_EL2 registers value UNKNOWN.
Accesses to this register use the following encodings in the System register encoding space:
G1-160 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-161
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides access to the base address for the MPU region determined by the value of 'n' and
PRSELR_EL1.REGION as PRSELR_EL1.REGION<7:4>:n.
Configurations
All bits above implemented physical address range in this register should be treated as RES0.
Attributes
PRBAR<n>_EL1 is a 64-bit register.
Field descriptions
63 52 51 48 47 32
RES0 BASE[47:6]
BASE[51:48]
31 6 5 4 3 2 1 0
BASE[47:6] XN
SH[1:0] RES0
AP[2:1]
Bits [63:52]
Reserved, RES0.
G1-162 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bit [0]
Reserved, RES0.
Accessing PRBAR<n>_EL1
Any access to MPU region register PRBAR<n>_EL1 above the number of implemented regions specified by
MPUIR_EL1.REGION is CONSTRAINED UNPREDICTABLE.
• Writes to unimplemented PRBAR<n>_EL1 register make all PRBAR_EL1 registers value UNKNOWN.
Accesses to this register use the following encodings in the System register encoding space:
integer m = UInt(CRm<2:0>:op2<2>);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-163
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
integer m = UInt(CRm<2:0>:op2<2>);
G1-164 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides access to the base address for the MPU region determined by the value of 'n' and
PRSELR_EL2.REGION as PRSELR_EL2.REGION<7:4>:n.
Configurations
All bits above implemented physical address range in this register should be treated as RES0.
Attributes
PRBAR<n>_EL2 is a 64-bit register.
Field descriptions
63 52 51 48 47 32
RES0 BASE[47:6]
BASE[51:48]
31 6 5 4 3 2 1 0
BASE[47:6] XN
SH[1:0] AP[2:1]
Bits [63:52]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-165
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing PRBAR<n>_EL2
Any access to MPU region register PRBAR<n>_EL2 above the number of implemented regions specified by
MPUIR_EL2.REGION is CONSTRAINED UNPREDICTABLE.
CONSTRAINED UNPREDICTABLE behavior is defined as:
• Writes to unimplemented PRBAR<n>_EL2 register make all PRBAR_EL2 registers value UNKNOWN.
Accesses to this register use the following encodings in the System register encoding space:
integer m = UInt(CRm<2:0>:op2<2>);
G1-166 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
integer m = UInt(CRm<2:0>:op2<2>);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-167
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides direct access to the PRLAR_EL1.EN bits of EL1 MPU regions from 0 to 31.
Configurations
There are no configuration notes.
Attributes
PRENR_EL1 is a 64-bit register.
Field descriptions
63 32
RES0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ENABLE31 ENABLE0
ENABLE30 ENABLE1
ENABLE29 ENABLE2
ENABLE28 ENABLE3
ENABLE27 ENABLE4
ENABLE26 ENABLE5
ENABLE25 ENABLE6
ENABLE24 ENABLE7
ENABLE23 ENABLE8
ENABLE22 ENABLE9
ENABLE21 ENABLE10
ENABLE20 ENABLE11
ENABLE19 ENABLE12
ENABLE18 ENABLE13
ENABLE17 ENABLE14
ENABLE16 ENABLE15
Bits [63:32]
Reserved, RES0.
Accessing PRENR_EL1
Accesses to this register use the following encodings in the System register encoding space:
G1-168 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-169
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides direct access to the PRLAR_EL2.EN bits of EL2 MPU regions from 0 to 31.
Configurations
There are no configuration notes.
Attributes
PRENR_EL2 is a 64-bit register.
Field descriptions
63 32
RES0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ENABLE31 ENABLE0
ENABLE30 ENABLE1
ENABLE29 ENABLE2
ENABLE28 ENABLE3
ENABLE27 ENABLE4
ENABLE26 ENABLE5
ENABLE25 ENABLE6
ENABLE24 ENABLE7
ENABLE23 ENABLE8
ENABLE22 ENABLE9
ENABLE21 ENABLE10
ENABLE20 ENABLE11
ENABLE19 ENABLE12
ENABLE18 ENABLE13
ENABLE17 ENABLE14
ENABLE16 ENABLE15
Bits [63:32]
Reserved, RES0.
Accessing PRENR_EL2
Accesses to this register use the following encodings in the System register encoding space:
G1-170 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-171
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides access to the limit addresses for the EL1 MPU region. PRSELR_EL1.REGION determines
which MPU region is selected.
Configurations
All bits above implemented physical address range in this register should be treated as RES0.
Attributes
PRLAR_EL1 is a 64-bit register.
Field descriptions
63 52 51 48 47 32
RES0 LIMIT[47:6]
LIMIT[51:48]
31 6 5 4 3 1 0
LIMIT[47:6] NS EN
RES0 AttrIndx[2:0]
Bits [63:52]
Reserved, RES0.
Bit [5]
Reserved, RES0.
G1-172 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing PRLAR_EL1
Any access to MPU region register PRLAR_EL1 above the number of implemented regions specified by
MPUIR_EL1.REGION is CONSTRAINED UNPREDICTABLE.
CONSTRAINED UNPREDICTABLE behavior is defined as:
• Writes to unimplemented PRLAR_EL1 register make all PRLAR_EL1 registers value UNKNOWN.
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-173
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
G1-174 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides access to the limit addresses for the EL2 MPU region. PRSELR_EL2.REGION determines
which MPU region is selected.
Configurations
All bits above implemented physical address range in this register should be treated as RES0.
Attributes
PRLAR_EL2 is a 64-bit register.
Field descriptions
63 52 51 48 47 32
RES0 LIMIT[47:6]
LIMIT[51:48]
31 6 5 4 3 1 0
LIMIT[47:6] NS EN
RES0 AttrIndx[2:0]
Bits [63:52]
Reserved, RES0.
Bit [5]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-175
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing PRLAR_EL2
Any access to MPU region register PRLAR_EL2 above the number of implemented regions specified by
MPUIR_EL2.REGION is CONSTRAINED UNPREDICTABLE.
CONSTRAINED UNPREDICTABLE behavior is defined as:
• Writes to unimplemented PRLAR_EL2 register make all PRLAR_EL2 registers value UNKNOWN.
Accesses to this register use the following encodings in the System register encoding space:
G1-176 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-177
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides access to the limit address for the MPU region determined by the value of 'n' and
PRSELR_EL1.REGION as PRSELR_EL1.REGION<7:4>:n.
Configurations
All bits above implemented physical address range in this register should be treated as RES0.
Attributes
PRLAR<n>_EL1 is a 64-bit register.
Field descriptions
63 52 51 48 47 32
RES0 LIMIT[47:6]
LIMIT[51:48]
31 6 5 4 3 1 0
LIMIT[47:6] NS EN
RES0 AttrIndx[2:0]
Bits [63:52]
Reserved, RES0.
Bit [5]
Reserved, RES0.
G1-178 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing PRLAR<n>_EL1
Any access to MPU region register PRLAR<n>_EL1 above the number of implemented regions specified by
MPUIR_EL1.REGION is CONSTRAINED UNPREDICTABLE.
CONSTRAINED UNPREDICTABLE behavior is defined as:
• Writes to unimplemented PRLAR<n>_EL1 register make all PRLAR_EL1 registers value UNKNOWN.
Accesses to this register use the following encodings in the System register encoding space:
integer m = UInt(CRm<2:0>:op2<2>);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-179
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
integer m = UInt(CRm<2:0>:op2<2>);
G1-180 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides access to the limit address for the MPU region determined by the value of 'n' and
PRSELR_EL2.REGION as PRSELR_EL2.REGION<7:4>:n.
Configurations
All bits above implemented physical address range in this register should be treated as RES0.
Attributes
PRLAR<n>_EL2 is a 64-bit register.
Field descriptions
63 52 51 48 47 32
RES0 LIMIT[47:6]
LIMIT[51:48]
31 6 5 4 3 1 0
LIMIT[47:6] NS EN
RES0 AttrIndx[2:0]
Bits [63:52]
Reserved, RES0.
Bit [5]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-181
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing PRLAR<n>_EL2
Any access to MPU region register PRLAR<n>_EL2 above the number of implemented regions specified by
MPUIR_EL2.REGION is CONSTRAINED UNPREDICTABLE.
CONSTRAINED UNPREDICTABLE behavior is defined as:
• Writes to unimplemented PRLAR<n>_EL2 register make all PRLAR_EL2 registers value UNKNOWN.
Accesses to this register use the following encodings in the System register encoding space:
integer m = UInt(CRm<2:0>:op2<2>);
G1-182 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
integer m = UInt(CRm<2:0>:op2<2>);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-183
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Selects the region number for the EL1 MPU region associated with the PRBAR_EL1 and
PRLAR_EL1 registers.
Configurations
There are no configuration notes.
Attributes
PRSELR_EL1 is a 64-bit register.
Field descriptions
63 32
RES0
31 8 7 0
RES0 REGION
Bits [63:8]
Reserved, RES0.
Accessing PRSELR_EL1
Accesses to this register use the following encodings in the System register encoding space:
G1-184 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-185
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Selects the region number for the EL2 MPU region associated with the PRBAR_EL2 and
PRLAR_EL2 registers.
Configurations
There are no configuration notes.
Attributes
PRSELR_EL2 is a 64-bit register.
Field descriptions
63 32
RES0
31 8 7 0
RES0 REGION
Bits [63:8]
Reserved, RES0.
Accessing PRSELR_EL2
Accesses to this register use the following encodings in the System register encoding space:
G1-186 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-187
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides top level control of the system, including its memory system, at EL1 and EL0.
Configurations
There are no configuration notes.
Attributes
SCTLR_EL1 is a 64-bit register.
Field descriptions
63 45 44 43 32
RES0 RES0
DSSBS
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RES1 EE BR I RES1 SA C A M
EnIA SA0
EnIB RES0
EnDA nAA
UCI UMA
E0E EnRCTX
SPAN RES1
RES1 EnDB
IESB DZE
TSCXT UCT
WXN nTWI
nTWE
Bits [63:45]
Reserved, RES0.
Bits [43:32]
Reserved, RES0.
G1-188 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
This field controls the behavior of the AddPACIA and AuthIA pseudocode functions. Specifically,
when the field is 1, AddPACIA returns a copy of a pointer to which a pointer authentication code
has been added, and AuthIA returns an authenticated copy of a pointer. When the field is 0, both of
these functions are NOP.
Note
This field controls the behavior of the AddPACIB and AuthIB pseudocode functions. Specifically,
when the field is 1, AddPACIB returns a copy of a pointer to which a pointer authentication code
has been added, and AuthIB returns an authenticated copy of a pointer. When the field is 0, both of
these functions are NOP.
Bits [29:28]
Reserved, RES1.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-189
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
This field controls the behavior of the AddPACDA and AuthDA pseudocode functions. Specifically,
when the field is 1, AddPACDA returns a copy of a pointer to which a pointer authentication code
has been added, and AuthDA returns an authenticated copy of a pointer. When the field is 0, both
of these functions are NOP.
G1-190 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bit [22]
Reserved, RES1.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-191
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
Since a WFE or WFI can complete at any time, even without a Wakeup event, the traps on WFE of
WFI are not guaranteed to be taken, even if the WFE or WFI is executed when there is no Wakeup
event. The only guarantee is that if the instruction does not complete in finite time in the absence of
a Wakeup event, the trap will be taken.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this bit has
no effect on execution at EL0.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL1, this field resets to an
architecturally UNKNOWN value.
G1-192 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
Since a WFE or WFI can complete at any time, even without a Wakeup event, the traps on WFE of
WFI are not guaranteed to be taken, even if the WFE or WFI is executed when there is no Wakeup
event. The only guarantee is that if the instruction does not complete in finite time in the absence of
a Wakeup event, the trap will be taken.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this bit has
no effect on execution at EL0.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL1, this field resets to an
architecturally UNKNOWN value.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-193
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Reading DCZID_EL0.DZP from EL0 returns 1, indicating that the instructions this trap
applies to are not supported.
0b1 This control does not cause any instructions to be trapped.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this bit has
no effect on execution at EL0.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL1, this field resets to an
architecturally UNKNOWN value.
Note
This field controls the behavior of the AddPACDB and AuthDB pseudocode functions. Specifically,
when the field is 1, AddPACDB returns a copy of a pointer to which a pointer authentication code
has been added, and AuthDB returns an authenticated copy of a pointer. When the field is 0, both of
these functions are NOP.
I, bit [12]
Stage 1 instruction access Cacheability control, for accesses at EL0 and EL1:
0b0 All instruction access to Stage 1 Normal memory from EL0 and EL1 are Stage 1
Non-cacheable.
If stage 1 EL1&0 translation is in VMSAv8-64 context and the value of SCTLR_EL1.M
is 0, then instruction accesses from stage 1 are to Normal, Outer Shareable, Inner
Non-cacheable, Outer Non-cacheable memory.
If stage 1 EL1&0 translation is in PMSAv8-64 context and the value of
SCTLR_EL1.{BR, M} = {0, 0}, then instruction accesses from stage 1 are to Normal,
Outer Shareable, Inner Non-cacheable, Outer Non-cacheable memory.
0b1 This control has no effect on the Stage 1 Cacheability of instruction access to Stage 1
Normal memory from EL0 and EL1.
If stage 1 EL1&0 translation is in VMSAv8-64 context and the value of SCTLR_EL1.M
is 0, then instruction accesses from stage 1 are to Normal, Outer Shareable, Inner
Write-Through, Outer Write-Through memory.
If stage 1 EL1&0 translation is in PMSAv8-64 context, and the value of
SCTLR_EL1.{BR, M} = {0, 0}, then instruction accesses from stage 1 are to Normal,
Outer Shareable, Inner Write-Through, Outer Write-Through memory.
When the value of the HCR_EL2.DC bit is 1, then instruction access to Normal memory from EL0
and EL1 are Cacheable regardless of the value of the SCTLR_EL1.I bit.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this bit has
no effect on the PE.
G1-194 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bit [11]
Reserved, RES1.
Bits [8:7]
Reserved, RES1.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-195
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Bit [5]
Reserved, RES0.
C, bit [2]
Stage 1 Cacheability control, for data accesses.
0b0 All data access to Stage 1 Normal memory from EL0 and EL1, and all Normal memory
accesses from unified cache to the EL1&0 Stage 1 translation tables, are treated as Stage
1 Non-cacheable.
0b1 This control has no effect on the Stage 1 Cacheability of:
• Data access to Normal memory from EL0 and EL1.
• Normal memory accesses to the EL1&0 Stage 1 translation tables.
When the value of the HCR_EL2.DC bit is 1, the PE ignores SCTLR.C. This means that Non-secure
EL0 and Non-secure EL1 data accesses to Normal memory are Cacheable.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this bit has
no effect on the PE.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL1, this field resets to 0.
A, bit [1]
Alignment check enable. This is the enable bit for Alignment fault checking at EL1 and EL0.
0b0 Alignment fault checking disabled when executing at EL1 or EL0.
Instructions that load or store one or more registers, other than load/store exclusive and
load-acquire/store-release, do not check that the address being accessed is aligned to the
size of the data element(s) being accessed.
0b1 Alignment fault checking enabled when executing at EL1 or EL0.
G1-196 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
All instructions that load or store one or more registers have an alignment check that the
address being accessed is aligned to the size of the data element(s) being accessed. If
this check fails it causes an Alignment fault, which is taken as a Data Abort exception.
Load/store exclusive and load-acquire/store-release instructions have an alignment check regardless
of the value of the A bit.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this bit has
no effect on execution at EL0.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL1, this field resets to an
architecturally UNKNOWN value.
M, bit [0]
MMU or MPU enable for EL1&0 stage 1 address translation.
This is the enable bit for:
• MPU, if stage 1 EL1&0 translation is in PMSAv8-64 context.
• MMU, if stage 1 EL1&0 translation is in VMSAv8-64 context.
0b0 EL1 MPU(PMSAv8-64) or MMU(VMSAv8-64) disabled
See the SCTLR_EL1.I field for the behavior of instruction accesses to Normal memory.
0b1 EL1 MPU(PMSAv8-64) or MMU(VMSAv8-64) enabled
If the value of HCR_EL2.{DC, TGE} is not {0, 0} then in Non-secure state the PE behaves as if the
value of the SCTLR_EL1.M field is 0 for all purposes other than returning the value of a direct read
of the field.
When FEAT_VHE is implemented, and the value of HCR_EL2.{E2H, TGE} is {1, 1}, this bit has
no effect on the PE.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL1, this field resets to 0.
Accessing SCTLR_EL1
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-197
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
G1-198 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides top level control of the system, including its memory system, at EL2.
Configurations
There are no configuration notes.
Attributes
SCTLR_EL2 is a 64-bit register.
Field descriptions
63 45 44 43 32
RES0 RES0
DSSBS
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 7 6 5 4 3 2 1 0
Bits [63:45]
Reserved, RES0.
Bits [43:32]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-199
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
This field controls the behavior of the AddPACIA and AuthIA pseudocode functions. Specifically,
when the field is 1, AddPACIA returns a copy of a pointer to which a pointer authentication code
has been added, and AuthIA returns an authenticated copy of a pointer. When the field is 0, both of
these functions are NOP.
Note
This field controls the behavior of the AddPACIB and AuthIB pseudocode functions. Specifically,
when the field is 1, AddPACIB returns a copy of a pointer to which a pointer authentication code
has been added, and AuthIB returns an authenticated copy of a pointer. When the field is 0, both of
these functions are NOP.
Bits [29:28]
Reserved, RES1.
Note
This field controls the behavior of the AddPACDA and AuthDA pseudocode functions. Specifically,
when the field is 1, AddPACDA returns a copy of a pointer to which a pointer authentication code
has been added, and AuthDA returns an authenticated copy of a pointer. When the field is 0, both
of these functions are NOP.
G1-200 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bit [26]
Reserved, RES0.
Bit [24]
Reserved, RES0.
Bits [23:22]
Reserved, RES1.
Bit [20]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-201
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
0b1 Any region that is writable in the EL2 or EL2&0 translation regime is forced to XN for
accesses from software executing at EL2.
This bit applies only when SCTLR_EL2.M bit is set.
The WXN bit is permitted to be cached in a TLB.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL2, this field resets to an
architecturally UNKNOWN value.
Bit [18]
Reserved, RES1.
Bit [16]
Reserved, RES1.
Bits [15:14]
Reserved, RES0.
Note
This field controls the behavior of the AddPACDB and AuthDB pseudocode functions. Specifically,
when the field is 1, AddPACDB returns a copy of a pointer to which a pointer authentication code
has been added, and AuthDB returns an authenticated copy of a pointer. When the field is 0, both of
these functions are NOP.
I, bit [12]
Instruction access Cacheability control, for accesses at EL2.
0b0 All instruction accesses to Normal memory from EL2 are Non-cacheable for all levels
of instruction and unified cache.
G1-202 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
If SCTLR_EL2.{BR, M} == {0, 0}, then instruction accesses from stage 1 of the EL2
translation regime are to Normal, Outer Shareable, Inner Non-cacheable, Outer
Non-cacheable memory.
0b1 This control has no effect on the Cacheability of instruction access to Normal memory
from EL2.
If SCTLR_EL2.{BR, M} = {0, 0}, then instruction accesses from stage 1 of the EL2
translation regime are to Normal, Outer Shareable, Inner Write-Through, Outer
Write-Through memory.
This bit has no effect on the EL1&0 translation regime.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL2, this field resets to 0.
Bit [11]
Reserved, RES1.
Bits [10:7]
Reserved, RES0.
Bits [5:4]
Reserved, RES1.
C, bit [2]
Data access Cacheability control, for accesses at EL2.
0b0 All data accesses to Normal memory from EL2 are Non-cacheable for all levels of data
and unified cache.
0b1 This control has no effect on the Cacheability of data accesses to Normal memory from
EL2.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-203
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
A, bit [1]
Alignment check enable. This is the enable bit for Alignment fault checking at EL2.
0b0 Alignment fault checking disabled when executing at EL2.
Instructions that load or store one or more registers, other than load/store exclusive and
load-acquire/store-release, do not check that the address being accessed is aligned to the
size of the data element(s) being accessed.
0b1 Alignment fault checking enabled when executing at EL2.
All instructions that load or store one or more registers have an alignment check that the
address being accessed is aligned to the size of the data element(s) being accessed. If
this check fails it causes an Alignment fault, which is taken as a Data Abort exception.
Load/store exclusive and load-acquire/store-release instructions have an alignment check regardless
of the value of the A bit.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL2, this field resets to an
architecturally UNKNOWN value.
M, bit [0]
MPU enable for EL2 stage 1 and EL1&0 stage 2 address translation.
0b0 MPU disabled for EL2 and EL1&0 stage 2 address translation.
See the SCTLR_EL2.I field for the behavior of instruction accesses to Normal memory.
0b1 MPU enabled for EL2 and EL1&0 stage 2 address translation.
The reset behavior of this field is:
• On a Warm reset, in a system where the PE resets into EL2, this field resets to 0.
Accessing SCTLR_EL2
Accesses to this register use the following encodings in the System register encoding space:
G1-204 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-205
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
The control register for stage 1 of the EL1&0 translation regime.
Configurations
There are no configuration notes.
Attributes
TCR_EL1 is a 64-bit register.
Field descriptions
63 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 32
E0PD1 RES0
E0PD0 TBI0
TBID1 TBI1
TBID0 HPD0
HWU162 HPD1
HWU161 HWU059
HWU160 HWU060
HWU159 HWU061
HWU062
31 30 29 28 27 26 25 24 23 22 21 16 15 14 13 12 11 10 9 8 7 6 5 0
Any of the bits in TCR_EL1, other than the A1 bit and the EPDx bits when they have the value 1, are permitted to
be cached in a TLB.
Bits [63:57]
Reserved, RES0.
G1-206 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Bits [54:53]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-207
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
For the purpose of this field, all cache maintenance and address translation instructions that perform
address translation are treated as data accesses.
For more information, see 'Address tagging in AArch64 state'.
0b0 TCR_EL1.TBI0 applies to Instruction and Data accesses.
0b1 TCR_EL1.TBI0 applies to Data accesses only.
This affects addresses where the address would be translated by EL1 MPU.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Reserved, RES0.
G1-208 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-209
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Otherwise:
Reserved, RES0.
G1-210 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
When VTCR_EL2.MSA == 0:
Reserved, RES0.
Otherwise:
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-211
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
G1-212 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Otherwise, if the value of TBI0 is 1 and bit [55] of the target address to be stored to the PC is 0, then
bits[63:56] of that target address are also set to 0 before the address is stored in the PC, in the
following cases:
• A branch or procedure return within EL0 or EL1.
• An exception taken to EL1.
• An exception return to EL0 or EL1.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
When VTCR_EL2.MSA == 0:
Top Byte ignored. Indicates whether the top byte of an address is used for an address match for the
EL1 MPU regions, or ignored and used for tagged addresses.
0b0 Top Byte used in the address calculation.
0b1 Top Byte ignored in the address calculation.
This affects addresses generated in EL0 and EL1, where the address would be translated by the EL1
MPU.
If FEAT_PAuth is implemented and TCR_EL1.TBID0 is 1, then this field only applies to Data
accesses.
Otherwise, if the value of TBI0 is 1 and bit [55] of the target address to be stored to the PC is 0, then
bits[63:56] of that target address are also set to 0 before the address is stored in the PC, in the
following cases:
• A branch or procedure return within EL0 or EL1.
• An exception taken to EL1.
• An exception return to EL0 or EL1.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-213
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Otherwise:
Reserved, RES0.
Bit [35]
Reserved, RES0.
G1-214 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-215
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Otherwise:
Reserved, RES0.
G1-216 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Other values are reserved. The effect of programming this field to a Reserved value is that behavior
is CONSTRAINED UNPREDICTABLE.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Reserved, RES0.
Bit [6]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-217
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing TCR_EL1
Accesses to this register use the following encodings in the System register encoding space:
G1-218 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
The control register for stage 1 of the EL2, or EL2&0, translation regime:
• When the Effective value of HCR_EL2.E2H is 0, this register controls stage 1 of the EL2
translation regime, that supports a single VA range, translated using TTBR0_EL2.
• When the value of HCR_EL2.E2H is 1, this register controls stage 1 of the EL2&0 translation
regime, that supports both:
— A lower VA range, translated using TTBR0_EL2.
— A higher VA range, translated using TTBR1_EL2.
Configurations
If EL2 is not implemented, this register is RES0 from EL3.
This register has no effect if EL2 is not enabled in the current Security state.
Attributes
TCR_EL2 is a 64-bit register.
Field descriptions
63 32
RES0
31 30 29 28 24 23 22 21 20 19 0
Bits [63:32]
Reserved, RES0.
Bit [31]
Reserved, RES1.
Bit [30]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-219
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Otherwise:
Reserved, RES0.
Bits [28:24]
Reserved, RES0.
Bit [23]
Reserved, RES1.
Bits [22:21]
Reserved, RES0.
Bits [19:0]
Reserved, RES0.
Accessing TCR_EL2
Accesses to this register use the following encodings in the System register encoding space:
G1-220 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-221
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Holds the base address of the translation table for the initial lookup for stage 1 of the translation of
an address from the lower VA range in the EL1&0 translation regime, and other information for this
translation regime.
Configurations
There are no configuration notes.
Attributes
TTBR0_EL1 is a 64-bit register.
Field descriptions
63 48 47 32
ASID BADDR[47:1]
31 1 0
BADDR[47:1]
CnP
G1-222 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
A translation table is required to be aligned to the size of the table. If a table contains fewer than
eight entries, it must be aligned on a 64 byte address boundary.
Note
TCR_EL1.IPS==0b110 is permitted when FEAT_LPA is implemented and the 64KB translation
granule is used.
When the value of ID_AA64MMFR0_EL1.PARange indicates that the implementation does not
support a 52 bit PA size, if a translation table lookup uses this register when the Effective value of
TCR_EL1.IPS is 0b110 and the value of register bits[5:2] is nonzero, an Address size fault is
generated.
If any register bit[47:1] that is defined as RES0 has the value 1 when a translation table walk is done
using TTBR0_EL1, then the translation table base address might be misaligned, with effects that are
CONSTRAINED UNPREDICTABLE, and must be one of the following:
• Bits A[(x-1):0] of the stage 1 translation table base address are treated as if all the bits are
zero. The value read back from the corresponding register bits is either the value written to
the register or zero.
• The result of the calculation of an address for a translation table walk using this register can
be corrupted in those bits that are nonzero.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-223
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Note
If the value of the TTBR0_EL1.CnP bit is 1 on multiple PEs in the same Inner Shareable domain
and those TTBR0_EL1s do not point to the same translation table entries when the other conditions
specified for the case when the value of CnP is 1 apply, then the results of translations are
CONSTRAINED UNPREDICTABLE, see 'CONSTRAINED UNPREDICTABLE behaviors due to caching of
control or data values'.
Accessing TTBR0_EL1
Accesses to this register use the following encodings in the System register encoding space:
G1-224 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
AArch64.SystemAccessTrap(EL2, 0x18);
else
TTBR0_EL1 = X[t, 64];
elsif PSTATE.EL == EL2 then
TTBR0_EL1 = X[t, 64];
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-225
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
Provides configuration information for VMSAv8-64 and PMSAv8-64 virtualization using stage 2
of EL1&0 translation regime.
Configurations
There are no configuration notes.
Attributes
VSCTLR_EL2 is a 64-bit register.
Field descriptions
63 56 55 48 47 32
31 1 0
RES0
CnP
Bits [47:1]
Reserved, RES0.
G1-226 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
0b1 The stage 2 translations of the EL1&0 translation regime are the same for every other
PE in the Inner Shareable domain for which the value of VSCTLR_EL2.CnP is 1 and
the VMID is the same as the current VMID.
Note
If the value of VSCTLR_EL2.CnP bit is 1 on multiple PEs in the same Inner Shareable domain and
the stage 2 EL1&0 translation does not point to the same configurations when using the current
VMID, then the results of the translations are CONSTRAINED UNPREDICTABLE, see 'CONSTRAINED
UNPREDICTABLE behaviors due to caching of control or data values'.
In an implementation that does not support VMSAv8-64 at stage 1 EL1&0 translation regime this
field is RES0.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Reserved, RES0.
Accessing VSCTLR_EL2
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-227
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
The control register for stage 2 of the Secure EL1&0 translation regime.
Configurations
This register is present only when FEAT_SEL2 is implemented. Otherwise, direct accesses to
VSTCR_EL2 are UNDEFINED.
This register has no effect if EL2 is not enabled in the current Security state.
Attributes
VSTCR_EL2 is a 64-bit register.
Field descriptions
63 32
RES0
31 30 29 21 20 19 0
SA RES0 SC RES0
RES1
Bits [63:32]
Reserved, RES0.
Bit [31]
Reserved, RES1.
Bits [29:21]
Reserved, RES0.
Bits [19:0]
Reserved, RES0.
G1-228 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Accessing VSTCR_EL2
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-229
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.3 General system control registers
Purpose
The control register for stage 2 of the EL1&0 translation regime.
Configurations
If EL2 is not implemented, this register is RES0 from EL3.
This register has no effect if EL2 is not enabled in the current Security state.
Attributes
VTCR_EL2 is a 64-bit register.
Field descriptions
63 32
RES0
31 30 29 20 19 18 0
RES0 VS RES0
MSA NSA
Bits [63:32]
Reserved, RES0.
G1-230 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.3 General system control registers
Otherwise:
Reserved, RES0.
Bits [29:20]
Reserved, RES0.
Bits [18:0]
Reserved, RES0.
Accessing VTCR_EL2
Any of the bits in VTCR_EL2 are permitted to be cached in a TLB.
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-231
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.4 Debug registers
G1-232 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.4 Debug registers
Purpose
Holds control information for a breakpoint. Forms breakpoint n together with value register
DBGBVR<n>_EL1.
Configurations
AArch64 System register DBGBCR<n>_EL1 bits [31:0] are architecturally mapped to External
register DBGBCR<n>_EL1[31:0].
If breakpoint n is not implemented, accesses to this register are UNDEFINED.
Attributes
DBGBCR<n>_EL1 is a 64-bit register.
Field descriptions
63 32
RES0
31 24 23 20 19 16 15 14 13 12 9 8 5 4 3 2 1 0
HMC
Bits [63:24]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-233
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.4 Debug registers
G1-234 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.4 Debug registers
Bits [12:9]
Reserved, RES0.
Bits [8:5]
Reserved, RES1.
Bits [4:3]
Reserved, RES0.
E, bit [0]
Enable breakpoint DBGBVR<n>_EL1.
0b0 Breakpoint disabled.
0b1 Breakpoint enabled.
The reset behavior of this field is:
• On a Cold reset, this field resets to an architecturally UNKNOWN value.
Accessing DBGBCR<n>_EL1
Accesses to this register use the following encodings in the System register encoding space:
integer m = UInt(CRm<3:0>);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-235
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.4 Debug registers
integer m = UInt(CRm<3:0>);
G1-236 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.4 Debug registers
Purpose
Provides EL2 configuration options for self-hosted debug and the Performance Monitors Extension.
Configurations
If EL2 is not implemented, this register is RES0 from EL3.
This register has no effect if EL2 is not enabled in the current Security state.
Attributes
MDCR_EL2 is a 64-bit register.
Field descriptions
63 32
RES0
31 20 19 18 17 16 12 11 10 9 8 7 6 5 4 0
Bits [63:20]
Reserved, RES0.
Bit [18]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-237
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.4 Debug registers
If MDCR_EL2.HPMN is not 0, this field affects the operation of event counters in the range [0 ..
(MDCR_EL2.HPMN-1)].
This field does not affect the operation of other event counters.
If PMCR_EL0.DP is 1, this field affects PMCCNTR_EL0.
The reset behavior of this field is:
• On a Warm reset, this field resets to 0.
When FEAT_PMUv3p1 is implemented:
Guest Performance Monitors Disable. Controls event counting by some event counters at EL2.
0b0 Event counting and PMCCNTR_EL0 are not affected by this mechanism.
0b1 If ExternalSecureNoninvasiveDebugEnabled () is FALSE, event counting by some event
counters is prohibited at EL2, and if PMCR_EL0.DP is 1, PMCCNTR_EL0 is disabled
at EL2.
If ExternalSecureNoninvasiveDebugEnabled () is TRUE, this field does not affect the event counters
and does not affect PMCCNTR_EL0.
Otherwise:
• If MDCR_EL2.HPMN is not 0, this field affects the operation of event counters in the range
[0 .. (MDCR_EL2.HPMN-1)].
• This field does not affect the operation of other event counters.
• If PMCR_EL0.DP is 1, this field affects PMCCNTR_EL0.
The reset behavior of this field is:
• On a Warm reset, this field resets to 0.
Otherwise:
Reserved, RES0.
Bits [16:12]
Reserved, RES0.
Note
EL2 does not provide traps on debug register accesses through the optional memory-mapped
external debug interfaces.
System register accesses to the debug registers might have side-effects. When a System register
access is trapped to EL2, no side-effects occur before the exception is taken to EL2.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
G1-238 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.4 Debug registers
Note
These registers are not accessible at EL0.
This field is treated as being 1 for all purposes other than a direct read when one or more of the
following are true:
• MDCR_EL2.TDE == 1.
• HCR_EL2.TGE == 1.
System register accesses to the debug registers might have side-effects. When a System register
access is trapped to EL2, no side-effects occur before the exception is taken to EL2.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Trap debug OS-related register access. Traps EL1 System register accesses to the powerdown debug
registers to EL2, from both Execution states as follows:
• In AArch64 state, accesses to the following registers are trapped to EL2, reported using EC
syndrome value 0x18:
— OSLAR_EL1, OSLSR_EL1, and DBGPRCR_EL1.
— Any IMPLEMENTATION DEFINED register with similar functionality that the
implementation specifies as trapped by this bit.
It is IMPLEMENTATION DEFINED whether accesses to OSDLR_EL1 are trapped.
0b0 This control does not cause any instructions to be trapped.
0b1 EL1 System register accesses to the powerdown debug registers are trapped to EL2
when EL2 is enabled in the current Security state.
Note
These registers are not accessible at EL0.
This field is treated as being 1 for all purposes other than a direct read when one or more of the
following are true:
• MDCR_EL2.TDE == 1.
• HCR_EL2.TGE == 1.
Note
EL2 does not provide traps on debug register accesses through the optional memory-mapped
external debug interfaces.
System register accesses to the debug registers might have side-effects. When a System register
access is trapped to EL2, no side-effects occur before the exception is taken to EL2.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-239
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.4 Debug registers
G1-240 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.4 Debug registers
Note
EL2 does not provide traps on Performance Monitor register accesses through the optional
memory-mapped external debug interface.
Note
EL2 does not provide traps on Performance Monitor register accesses through the optional
memory-mapped external debug interface.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-241
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.4 Debug registers
Accessing MDCR_EL2
Accesses to this register use the following encodings in the System register encoding space:
G1-242 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.4 Debug registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-243
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.4 Debug registers
Purpose
Main control register for the debug implementation.
Configurations
There are no configuration notes.
Attributes
MDSCR_EL1 is a 64-bit register.
Field descriptions
63 32
RES0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 16 15 14 13 12 11 7 6 5 1 0
Bits [63:32]
Reserved, RES0.
G1-244 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.4 Debug registers
Bit [28]
Reserved, RES0.
Bits [25:24]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-245
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.4 Debug registers
Bits [20:19]
Reserved, RES0.
Bits [18:16]
Reserved, RAZ/WI.
Hardware must implement this field as RAZ/WI. Software must not rely on the register reading as
zero, and must use a read-modify-write sequence to write to the register.
G1-246 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.4 Debug registers
Bits [11:7]
Reserved, RES0.
Bits [5:1]
Reserved, RES0.
Accessing MDSCR_EL1
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-247
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.4 Debug registers
AArch64.SystemAccessTrap(EL2, 0x18);
else
X[t, 64] = MDSCR_EL1;
elsif PSTATE.EL == EL2 then
X[t, 64] = MDSCR_EL1;
G1-248 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-249
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
Purpose
Determines the modes in which the Cycle Counter, PMCCNTR_EL0, increments.
Configurations
AArch64 System register PMCCFILTR_EL0 bits [31:0] are architecturally mapped to External
register PMCCFILTR_EL0[31:0].
This register is present only when FEAT_PMUv3 is implemented. Otherwise, direct accesses to
PMCCFILTR_EL0 are UNDEFINED.
Attributes
PMCCFILTR_EL0 is a 64-bit register.
Field descriptions
63 32
RES0
31 30 29 28 27 26 0
P U RES0 RES0
NSH
Bits [63:32]
Reserved, RES0.
P, bit [31]
Privileged filtering bit. Controls counting in EL1.
0b0 Count cycles in EL1.
0b1 Do not count cycles in EL1.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
U, bit [30]
User filtering bit. Controls counting in EL0.
0b0 Count cycles in EL0.
0b1 Do not count cycles in EL0.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Bits [29:28]
Reserved, RES0.
G1-250 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
Bits [26:0]
Reserved, RES0.
Accessing PMCCFILTR_EL0
PMCCFILTR_EL0 can also be accessed by using PMXEVTYPER_EL0 with PMSELR_EL0.SEL set to 0b11111.
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-251
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
Purpose
Provides details of the Performance Monitors implementation, including the number of counters
implemented, and configures and controls the counters.
Configurations
AArch64 System register PMCR_EL0 bits [7:0] are architecturally mapped to External register
PMCR_EL0[7:0].
This register is present only when FEAT_PMUv3 is implemented. Otherwise, direct accesses to
PMCR_EL0 are UNDEFINED.
Attributes
PMCR_EL0 is a 64-bit register.
Field descriptions
63 32
RES0
31 24 23 16 15 11 10 7 6 5 4 3 2 1 0
RES1 RES0
Bits [63:32]
Reserved, RES0.
G1-252 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
N, bits [15:11]
Indicates the number of event counters implemented. This value is in the range of 0b00000-0b11111.
If the value is 0b00000, then only PMCCNTR_EL0 is implemented. If the value is 0b11111, then
PMCCNTR_EL0 and 31 event counters are implemented.
When EL2 is implemented and enabled for the current Security state, reads of this field from EL1
and EL0 return the value of MDCR_EL2.HPMN.
This field has an IMPLEMENTATION DEFINED value.
Access to this field is RO.
Bits [10:7]
Reserved, RES0.
Bit [6]
Reserved, RES1.
X, bit [4]
When the implementation includes a PMU event export bus:
Enable export of events in an IMPLEMENTATION DEFINED PMU event export bus.
0b0 Do not export events.
0b1 Export events where not prohibited.
This field enables the exporting of events over an IMPLEMENTATION DEFINED PMU event export bus
to another device, for example to an OPTIONAL trace unit.
No events are exported when counting is prohibited.
This field does not affect the generation of Performance Monitors overflow interrupt requests or
signaling to a cross-trigger interface (CTI) that can be implemented as signals exported from the PE.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-253
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
Bit [3]
Reserved, RES0.
C, bit [2]
Cycle counter reset. The effects of writing to this bit are:
0b0 No action.
0b1 Reset PMCCNTR_EL0 to zero.
Note
Resetting PMCCNTR_EL0 does not change the cycle counter overflow bit.
P, bit [1]
Event counter reset.
In the description of this field:
• If EL2 is implemented and is using AArch64, PMN is MDCR_EL2.HPMN.
• If EL2 is not implemented, PMN is PMCR_EL0.N.
0b0 No action.
0b1 If n is in the range of affected event counters, resets each event counter
PMEVCNTR<n>_EL0 to zero.
The effects of writing to this bit are:
• If EL2 is implemented and enabled in the current Security state, in EL0 and EL1, if PMN is
not 0, a write of 1 to this bit resets event counters in the range [0 .. (PMN-1)].
• If EL2 is disabled in the current Security state, a write of 1 to this bit resets all the event
counters.
• In EL2 and EL3, a write of 1 to this bit resets all the event counters.
• This field does not affect the operation of other event counters and PMCCNTR_EL0.
Note
Resetting the event counters does not change the event counter overflow bits.
E, bit [0]
Enable.
If EL2 is implemented and is using AArch64, PMN is MDCR_EL2.HPMN.
If EL2 is not implemented, PMN is PMCR_EL0.N.
0b0 PMCCNTR_EL0 is disabled and event counters PMEVCNTR<n>_EL0, where n is in
the range of affected event counters, are disabled.
0b1 PMCCNTR_EL0 and event counters PMEVCNTR<n>_EL0, where n is in the range of
affected event counters, are enabled by PMCNTENSET_EL0.
If PMN is not 0, this field affects the operation of event counters in the range [0 .. (PMN-1)].
This field does not affect the operation of other event counters.
The operation of this field applies even when EL2 is disabled in the current Security state.
G1-254 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
Accessing PMCR_EL0
Accesses to this register use the following encodings in the System register encoding space:
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-255
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
G1-256 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
Purpose
Configures event counter n, where n is 0 to 30.
Configurations
AArch64 System register PMEVTYPER<n>_EL0 bits [31:0] are architecturally mapped to
External register PMEVTYPER<n>_EL0[31:0].
This register is present only when FEAT_PMUv3 is implemented. Otherwise, direct accesses to
PMEVTYPER<n>_EL0 are UNDEFINED.
Attributes
PMEVTYPER<n>_EL0 is a 64-bit register.
Field descriptions
63 32
RES0
31 30 29 28 27 26 25 24 16 15 10 9 0
Bits [63:32]
Reserved, RES0.
P, bit [31]
Privileged filtering bit. Controls counting in EL1.
0b0 Count events in EL1.
0b1 Do not count events in EL1.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
U, bit [30]
User filtering bit. Controls counting in EL0.
0b0 Count events in EL0.
0b1 Do not count events in EL0.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Bits [29:28]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-257
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
Bit [26]
Reserved, RES0.
Bits [24:16]
Reserved, RES0.
Note
UNPREDICTABLE means the event must not expose privileged information.
G1-258 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
Accessing PMEVTYPER<n>_EL0
PMEVTYPER<n>_EL0 can also be accessed by using PMXEVTYPER_EL0 with PMSELR_EL0.SEL set to n.
If <n> is greater than or equal to the number of accessible event counters, then reads and writes of
PMEVTYPER<n>_EL0 are CONSTRAINED UNPREDICTABLE, and the following behaviors are permitted:
• Accesses to the register behave as if <n> is an UNKNOWN value less-than-or-equal-to the index of the highest
accessible event counter.
• If EL2 is implemented and enabled in the current Security state, and <n> is less than the number of
implemented event counters, accesses from EL1 or permitted accesses from EL0 are trapped to EL2.
Note
In EL0, an access is permitted if it is enabled by PMUSERENR_EL0.EN.
If EL2 is implemented and enabled in the current Security state, in EL1 and EL0, MDCR_EL2.HPMN identifies
the number of accessible event counters. Otherwise, the number of accessible event counters is the number of
implemented event counters. For more information, see MDCR_EL2.HPMN.
Accesses to this register use the following encodings in the System register encoding space:
integer m = UInt(CRm<1:0>:op2<2:0>);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G1-259
ID062922 Non-Confidential
System Registers in a PMSA Implementation
G1.5 Performance Monitors registers
integer m = UInt(CRm<1:0>:op2<2:0>);
G1-260 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Chapter G2
System Registers in a VMSA Implementation
This chapter describes the System registers in a VMSA implementation. It contains the following section:
• General system control registers on page G2-262.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G2-261
ID062922 Non-Confidential
System Registers in a VMSA Implementation
G2.1 General system control registers
G2-262 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a VMSA Implementation
G2.1 General system control registers
Purpose
Holds the base address of the translation table for the initial lookup for stage 1 of the translation of
an address from the higher VA range in the EL1&0 stage 1 translation regime, and other information
for this translation regime.
Configurations
This register is present only when architecture implements VMSA extension. Otherwise, direct
accesses to TTBR1_EL1 are UNDEFINED.
In a PMSAv8-64 only implementation, this register is UNDEFINED.
Attributes
TTBR1_EL1 is a 64-bit register.
Field descriptions
63 48 47 32
ASID BADDR[47:1]
31 1 0
BADDR[47:1]
CnP
Note
A translation table is required to be aligned to the size of the table. If a table contains fewer than
eight entries, it must be aligned on a 64 byte address boundary.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G2-263
ID062922 Non-Confidential
System Registers in a VMSA Implementation
G2.1 General system control registers
• If the implementation supports 52-bit PAs and IPAs, then bits A[51:48] of the stage 1
translation table base address are 0b0000.
If FEAT_LPA is implemented and the value of TCR_EL1.IPS is 0b110, then:
• Bits A[51:48] of the stage 1 translation table base address bits are in register bits[5:2].
• Register bit[1] is RES0.
• When x>6, register bits[(x-1):6] are RES0.
Note
TCR_EL1.IPS==0b110 is permitted when FEAT_LPA is implemented and the 64KB translation
granule is used.
When the value of ID_AA64MMFR0_EL1.PARange indicates that the implementation does not
support a 52 bit PA size, if a translation table lookup uses this register when the Effective value of
TCR_EL1.IPS is 0b110 and the value of register bits[5:2] is nonzero, an Address size fault is
generated.
If any register bit[47:1] that is defined as RES0 has the value 1 when a translation table walk is done
using TTBR1_EL1, then the translation table base address might be misaligned, with effects that are
CONSTRAINED UNPREDICTABLE, and must be one of the following:
• Bits A[(x-1):0] of the stage 1 translation table base address are treated as if all the bits are
zero. The value read back from the corresponding register bits is either the value written to
the register or zero.
• The result of the calculation of an address for a translation table walk using this register can
be corrupted in those bits that are nonzero.
The reset behavior of this field is:
• On a Warm reset, this field resets to an architecturally UNKNOWN value.
Otherwise:
Reserved, RES0.
G2-264 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
System Registers in a VMSA Implementation
G2.1 General system control registers
When a TLB combines entries from stage 1 translation and stage 2 translation into a single entry,
that entry can only be shared between different PEs if the value of the CnP bit is 1 for both stage 1
and stage 2.
Note
If the value of the TTBR1_EL1.CnP bit is 1 on multiple PEs in the same Inner Shareable domain
and those TTBR1_EL1s do not point to the same translation table entries when the other conditions
specified for the case when the value of CnP is 1 apply, then the results of translations are
CONSTRAINED UNPREDICTABLE, see 'CONSTRAINED UNPREDICTABLE behaviors due to
caching of control or data values'.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. G2-265
ID062922 Non-Confidential
System Registers in a VMSA Implementation
G2.1 General system control registers
else
TTBR1_EL1 = X[t];
elsif PSTATE.EL == EL2 then
if ID_AA64MMFR0_EL1.MSA == '1111' && ID_AA64MMFR0_EL1.MSA_frac == '0001' then
UNDEFINED;
else
TTBR1_EL1 = X[t];
G2-266 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part H
Armv8-R AArch64 External Debug Registers
Chapter H1
External Debug Registers Descriptions
This chapter provides the information on the external debug registers that are supported in Armv8-R AArch64. It
contains the following sections:
• About the external debug registers on page H1-270.
• External debug registers on page H1-271.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-269
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.1 About the external debug registers
For more information, see chapter External System Control Register Descriptions of the Arm® Architecture
Reference Manual Armv8, for Armv8-A architecture profile.
H1-270 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-271
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
Purpose
Holds control information for a breakpoint. Forms breakpoint n together with value register
DBGBVR<n>_EL1.
Configurations
External register DBGBCR<n>_EL1 bits [31:0] are architecturally mapped to AArch64 System
register DBGBCR<n>_EL1[31:0].
DBGBCR<n>_EL1 is in the Core power domain.
If breakpoint n is not implemented then accesses to this register are:
• RES0 when IsCorePowered() && !DoubleLockStatus() && !OSLockStatus() &&
AllowExternalDebugAccess().
• A CONSTRAINED UNPREDICTABLE choice of RES0 or ERROR otherwise.
Attributes
DBGBCR<n>_EL1 is a 32-bit register.
Field descriptions
31 24 23 20 19 16 15 14 13 12 9 8 5 4 3 2 1 0
HMC
When the E field is zero, all the other fields in the register are ignored.
Bits [31:24]
Reserved, RES0.
H1-272 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
Bits [12:9]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-273
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
Bits [8:5]
Reserved, RES1.
Bits [4:3]
Reserved, RES0.
E, bit [0]
Enable breakpoint DBGBVR<n>_EL1. Possible values are:
0b0 Breakpoint disabled.
0b1 Breakpoint enabled.
The reset behavior of this field is:
• On a Cold reset, this field resets to an architecturally UNKNOWN value.
H1-274 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
Purpose
Provides information about implemented PE features.
Note
The register mnemonic, EDAA32PFR, is derived from previous definitions of this register that
defined this register only when AArch64 was not supported.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
It is IMPLEMENTATION DEFINED whether EDAA32PFR is implemented in the Core power domain
or in the Debug power domain.
Attributes
EDAA32PFR is a 64-bit register.
Field descriptions
63 32
RES0
31 20 19 16 15 12 11 8 7 4 3 0
Bits [63:20]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-275
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
Note
EDPFR.{EL1, EL0} indicate whether EL1 and EL0 can only be executed in AArch32 state.
Otherwise:
Reserved, RAZ.
Note
EDPFR.{EL1, EL0} indicate whether EL1 and EL0 can only be executed in AArch32 state.
Otherwise:
Reserved, RAZ.
H1-276 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-277
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
Purpose
Identifies the programmers' model architecture of the external debug component.
Configurations
Implementation of this register is OPTIONAL.
If FEAT_DoPD is implemented, this register is in the Core power domain.
If FEAT_DoPD is not implemented, this register is in the Debug power domain.
Attributes
EDDEVARCH is a 32-bit register.
Field descriptions
31 21 20 19 16 15 12 11 0
0 1 0 0 0 1 1 1 0 1 1 1 0 0 0 0 ARCHVER 1 0 1 0 0 0 0 0 0 1 0 1
H1-278 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
From Armv8.2, the values 0b0110 and 0b0111 are not permitted.
From Armv8.4, the value 0b1000 is not permitted.
• When FEAT_DoPD is not implemented or IsCorePowered() accesses to this register are RO.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-279
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
Purpose
Provides information about implemented PE features.
For general information about the interpretation of the ID registers, see 'Principles of the ID scheme
for fields in ID registers'.
Configurations
It is IMPLEMENTATION DEFINED whether EDPFR is implemented in the Core power domain or in the
Debug power domain.
Attributes
EDPFR is a 64-bit register.
Field descriptions
63 52 51 48 47 44 43 40 39 36 35 32
31 28 27 24 23 20 19 16 15 12 11 8 7 4 3 0
Bits [63:52]
Reserved, RES0.
Bits [51:48]
From Armv8.4:
Reserved, UNKNOWN.
Otherwise:
Reserved, RES0.
Bits [47:44]
Reserved, RES0.
Bits [43:40]
From Armv8.2:
Reserved, UNKNOWN.
Otherwise:
Reserved, RES0.
Bits [35:32]
Reserved, RES0.
H1-280 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
Bits [31:28]
From Armv8.2:
Reserved, UNKNOWN.
Otherwise:
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-281
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
H1-282 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-283
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
Purpose
Determines the modes in which the Cycle Counter, PMCCNTR_EL0, increments.
Configurations
External register PMCCFILTR_EL0[31:0] is architecturally mapped to AArch64 System register
PMCCFILTR_EL0[31:0].
PMCCFILTR_EL0 is in the Core power domain.
On a Warm or Cold reset, RW fields in this register reset:
• To architecturally UNKNOWN values if the reset is to an Exception level that is using
AArch64.
• To 0 if the reset is to an Exception level that is using AArch32.
Attributes
PMCCFILTR_EL0 is a 32-bit register.
Field descriptions
The PMCCFILTR_EL0 bit assignments are:
31 30 29 28 27 26 0
P U RES0 RES0
NSH
P, bit [31]
Privileged filtering bit. Controls counting in EL1.
0b0 Count cycles in EL1.
0b1 Do not count cycles in EL1.
U, bit [30]
User filtering bit. Controls counting in EL0.
0b0 Count cycles in EL0.
0b1 Do not count cycles in EL0.
Bits [29:28]
Reserved, RES0.
H1-284 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
Bits [26:25]
Reserved, RES0.
Bits [23:0]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-285
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
Purpose
Provides details of the Performance Monitors implementation, including the number of counters
implemented, and configures and controls the counters.
Configurations
External register PMCR_EL0[7:0] is architecturally mapped to AArch64 System register
PMCR_EL0[7:0].
PMCR_EL0 is in the Core power domain.
Attributes
PMCR_EL0 is a 32-bit register.
Field descriptions
The PMCR_EL0 bit assignments are:
31 11 10 7 6 5 4 3 2 1 0
RAZ/WI RES0 DP X C P E
RES1 RES0
Bits [31:11]
Reserved, RAZ/WI.
Hardware must implement this field as RAZ/WI. Software must not rely on the register reading as
zero, and must use a read-modify-write sequence to write to the register.
Bits [10:7]
Reserved, RES0.
Bit [6]
Reserved, RES1.
Otherwise:
Reserved, RES0.
H1-286 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
X, bit [4]
When the implementation includes a PMU event export bus:
Enable export of events in an IMPLEMENTATION DEFINED PMU event export bus.
0b0 Do not export events.
0b1 Export events where not prohibited.
This field enables the exporting of events over an IMPLEMENTATION DEFINED PMU event export bus
to another device, for example to an OPTIONAL PE trace unit.
No events are exported when counting is prohibited.
This field does not affect the generation of Performance Monitors overflow interrupt requests or
signaling to a cross-trigger interface (CTI) that can be implemented as signals exported from the PE.
When this register has an architecturally-defined reset value, if this field is implemented as an RW
field it resets to:
• A value that is architecturally UNKNOWN if the reset is into an Exception level that is using
AArch64.
Otherwise:
Reserved, RAZ/WI.
Bit [3]
Reserved, RES0.
C, bit [2]
Cycle counter reset. The effects of writing to this bit are:
0b0 No action.
0b1 Reset PMCCNTR_EL0 to zero.
Note
Resetting PMCCNTR_EL0 does not change the cycle counter overflow bit.
P, bit [1]
Event counter reset. The effects of writing to this bit are:
0b0 No action.
0b1 Reset all event counters, not including PMCCNTR_EL0, to zero.
Note
Resetting the event counters does not change the event counter overflow bits.
E, bit [0]
Enable.
0b0 All event counters in the range [0..(PMN-1)] and PMCCNTR_EL0, are disabled.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-287
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
0b1 All event counters in the range [0..(PMN-1)] and PMCCNTR_EL0, are enabled by
PMCNTENSET_EL0.
Note
The effect of the following fields on the operation of this bit applies if EL2 is implemented
regardless of whether EL2 is enabled in the current Security state:
• MDCR_EL2.HPMN. See the description of MDCR_EL2.HPMN for more information.
H1-288 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
Purpose
Configures event counter n, where n is 0 to 30.
Configurations
External register PMEVTYPER<n>_EL0[31:0] is architecturally mapped to AArch64 System
register PMEVTYPER<n>_EL0[31:0].
PMEVTYPER<n>_EL0 is in the Core power domain.
If event counter n is not implemented then accesses to this register are:
• RES0 when IsCorePowered() && !DoubleLockStatus() && !OSLockStatus() &&
AllowExternalPMUAccess().
• A CONSTRAINED UNPREDICTABLE choice of RES0 or ERROR otherwise.
Attributes
PMEVTYPER<n>_EL0 is a 32-bit register.
Field descriptions
The PMEVTYPER<n>_EL0 bit assignments are:
31 30 29 28 27 26 25 24 16 15 10 9 0
P, bit [31]
Privileged filtering bit. Controls counting in EL1.
0b0 Count events in EL1.
0b1 Do not count events in EL1.
U, bit [30]
User filtering bit. Controls counting in EL0.
0b0 Count events in EL0.
0b1 Do not count events in EL0.
Bits [29:28]
Reserved, RES0.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-289
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
Bit [26]
Reserved, RES0.
Note
• When the lowest level of affinity consists of logical PEs that are implemented using a
multi-threading type approach, an implementation is described as multi-threaded. That is, the
performance of PEs at the lowest affinity level is highly interdependent.
• Events from a different thread of a multithreaded implementation are not Attributable to the
thread counting the event.
Bits [23:16]
Reserved, RES0.
H1-290 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
External Debug Registers Descriptions
H1.2 External debug registers
The ranges of event numbers allocated to each type of event are shown in 'Allocation of the PMU
event number space'.
If evtCount is programmed to an event that is reserved or not supported by the PE, the behavior
depends on the value written:
• For the range 0x0000 to 0x003F, no events are counted, and the value returned by a direct or
external read of the evtCount field is the value written to the field.
• If 16-bit evtCount is implemented, for the range 0x4000 to 0x403F, no events are counted, and
the value returned by a direct or external read of the evtCount field is the value written to the
field.
• For IMPLEMENTATION DEFINED events, it is UNPREDICTABLE what event, if any, is counted,
and the value returned by a direct or external read of the evtCount field is UNKNOWN.
Note
UNPREDICTABLE means the event must not expose privileged information.
Arm recommends that the behavior across a family of implementations is defined such that if a
given implementation does not include an event from a set of common IMPLEMENTATION DEFINED
events, then no event is counted and the value read back on evtCount is the value written.
On a Warm reset, this field resets to an architecturally UNKNOWN value.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. H1-291
ID062922 Non-Confidential
External Debug Registers Descriptions
H1.2 External debug registers
H1-292 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Part I
Architectural Pseudocode
Chapter I1
Armv8-R AArch64 Pseudocode
This chapter contains the pseudocode that describes many features of the Armv8-R AArch64 architecture. It
contains the following sections:
• Pseudocode for AArch64 operations on page I1-296.
• Shared pseudocode on page I1-426.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-295
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
This section is organized by functional groups, with the functional groups being indicated by hierarchical path
names, for example aarch64/debug/breakpoint.
I1.1.1 aarch64/debug
This section includes the following pseudocode functions:
• aarch64/debug/breakpoint/AArch64.BreakpointMatch.
• aarch64/debug/breakpoint/AArch64.BreakpointValueMatch on page I1-297.
• aarch64/debug/breakpoint/AArch64.StateMatch on page I1-298.
• aarch64/debug/enables/AArch64.GenerateDebugExceptions on page I1-299.
• aarch64/debug/enables/AArch64.GenerateDebugExceptionsFrom on page I1-300.
• aarch64/debug/pmu/AArch64.CheckForPMUOverflow on page I1-300.
• aarch64/debug/pmu/AArch64.ClearEventCounters on page I1-300.
• aarch64/debug/pmu/AArch64.CountPMUEvents on page I1-300.
• aarch64/debug/pmu/AArch64.GetNumEventCountersAccessible on page I1-302.
• aarch64/debug/pmu/AArch64.IncrementEventCounter on page I1-302.
• aarch64/debug/pmu/AArch64.PMUCounterIsHyp on page I1-302.
• aarch64/debug/pmu/AArch64.PMUCycle on page I1-303.
• aarch64/debug/pmu/AArch64.PMUSwIncrement on page I1-303.
• aarch64/debug/statisticalprofiling/TimeStamp on page I1-303.
• aarch64/debug/takeexceptiondbg/AArch64.TakeExceptionInDebugState on page I1-304.
• aarch64/debug/watchpoint/AArch64.WatchpointByteMatch on page I1-304.
• aarch64/debug/watchpoint/AArch64.WatchpointMatch on page I1-305.
aarch64/debug/breakpoint/AArch64.BreakpointMatch
// AArch64.BreakpointMatch()
// =========================
// Breakpoint matching in an AArch64 translation regime.
I1-296 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return match;
aarch64/debug/breakpoint/AArch64.BreakpointValueMatch
// AArch64.BreakpointValueMatch()
// ==============================
// If this breakpoint is not enabled, it cannot generate a match. (This could also happen on a
// call from StateMatch for linking).
if DBGBCR_EL1[n].E == '0' then return FALSE;
// If this is a call from StateMatch, return FALSE if the breakpoint is not programmed for a
// VMID and/or context ID match, of if not context-aware. The above assertions mean that the
// code can just test for match_addr == TRUE to confirm all these things.
if linked_to && (!linked || match_addr) then return FALSE;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-297
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
// If called from BreakpointMatch return FALSE for Linked context ID and/or VMID matches.
if !linked_to && linked && !match_addr then return FALSE;
// Do the comparison.
boolean BVR_match;
if match_addr then
boolean byte_select_match;
byte = UInt(vaddress<1:0>);
assert byte == 0; // "vaddress" is word aligned
byte_select_match = TRUE; // DBGBCR_EL1[n].BAS<byte> is RES1
// If the DBGxVR<n>_EL1.RESS field bits are not a sign extension of the MSB
// of DBGBVR<n>_EL1.VA, it is UNPREDICTABLE whether they appear to be
// included in the match.
// If 'vaddress' is outside of the current virtual address space, then the access
// generates a Translation fault.
integer top = AArch64.VAMax();
if !IsOnes(DBGBVR_EL1[n]<63:top>) && !IsZero(DBGBVR_EL1[n]<63:top>) then
if ConstrainUnpredictableBool() then
top = 63;
BVR_match = (vaddress<top:2> == DBGBVR_EL1[n]<top:2>) && byte_select_match;
return match;
aarch64/debug/breakpoint/AArch64.StateMatch
// AArch64.StateMatch()
// ====================
// Determine whether a breakpoint or watchpoint is enabled in the current mode and state.
// "SSC_in","HMC_in","PxC_in" are the control fields from the DBGBCR[n] or DBGWCR[n] register.
// "linked_in" is TRUE if this is a linked breakpoint/watchpoint type.
// "LBN" is the linked breakpoint number from the DBGBCR[n] or DBGWCR[n] register.
// "isbreakpnt" is TRUE for breakpoints, FALSE for watchpoints.
// "ispriv" is valid for watchpoints, and selects between privileged and unprivileged accesses.
bits(2) SSC = SSC_in;
bit HMC = HMC_in;
bits(2) PxC = PxC_in;
boolean linked = linked_in;
I1-298 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
// If parameters are set to a reserved type, behaves as either disabled or a defined type
Constraint c;
(c, SSC, HMC, PxC) = CheckValidStateMatch(SSC, HMC, PxC, isbreakpnt);
if c == Constraint_DISABLED then return FALSE;
// Otherwise the HMC,SSC,PxC values are either valid or the values returned by
// CheckValidStateMatch are valid.
boolean priv_match;
if !ispriv && !isbreakpnt then
priv_match = EL0_match;
else
case PSTATE.EL of
when EL3 priv_match = EL3_match;
when EL2 priv_match = EL2_match;
when EL1 priv_match = EL1_match;
when EL0 priv_match = EL0_match;
boolean security_state_match;
ss = CurrentSecurityState();
case SSC of
when '00' security_state_match = TRUE; // Both
when '01' security_state_match = ss == SS_NonSecure; // Non-secure only
when '10' security_state_match = ss == SS_Secure; // Secure only
when '11' security_state_match = (HMC == '1' || ss == SS_Secure); // HMC=1 -> Both, 0 -> Secure
only
integer lbn;
if linked then
// "LBN" must be an enabled context-aware breakpoint unit. If it is not context-aware then
// it is CONSTRAINED UNPREDICTABLE whether this gives no match, or LBN is mapped to some
// UNKNOWN breakpoint that is context-aware.
lbn = UInt(LBN);
first_ctx_cmp = NumBreakpointsImplemented() - NumContextAwareBreakpointsImplemented();
last_ctx_cmp = NumBreakpointsImplemented() - 1;
if (lbn < first_ctx_cmp || lbn > last_ctx_cmp) then
(c, lbn) = ConstrainUnpredictableInteger(first_ctx_cmp, last_ctx_cmp,
Unpredictable_BPNOTCTXCMP);
assert c IN {Constraint_DISABLED, Constraint_NONE, Constraint_UNKNOWN};
case c of
when Constraint_DISABLED return FALSE; // Disabled
when Constraint_NONE linked = FALSE; // No linking
// Otherwise ConstrainUnpredictableInteger returned a context-aware breakpoint
boolean linked_match;
if linked then
vaddress = bits(64) UNKNOWN;
linked_to = TRUE;
linked_match = AArch64.BreakpointValueMatch(lbn, vaddress, linked_to);
aarch64/debug/enables/AArch64.GenerateDebugExceptions
// AArch64.GenerateDebugExceptions()
// =================================
boolean AArch64.GenerateDebugExceptions()
ss = CurrentSecurityState();
return AArch64.GenerateDebugExceptionsFrom(PSTATE.EL, ss, PSTATE.D);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-299
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/debug/enables/AArch64.GenerateDebugExceptionsFrom
// AArch64.GenerateDebugExceptionsFrom()
// =====================================
return enabled;
aarch64/debug/pmu/AArch64.CheckForPMUOverflow
// AArch64.CheckForPMUOverflow()
// =============================
// Signal Performance Monitors overflow IRQ and CTI overflow events
AArch64.CheckForPMUOverflow()
boolean pmuirq;
bit E;
pmuirq = PMCR_EL0.E == '1' && PMINTENSET_EL1.C == '1' && PMOVSSET_EL0.C == '1';
integer counters = GetNumEventCounters();
if counters != 0 then
for idx = 0 to counters - 1
E = if AArch64.PMUCounterIsHyp(idx) then MDCR_EL2.HPME else PMCR_EL0.E;
if E == '1' && PMINTENSET_EL1<idx> == '1' && PMOVSSET_EL0<idx> == '1' then pmuirq = TRUE;
// The request remains set until the condition is cleared. (For example, an interrupt handler
// or cross-triggered event handler clears the overflow status flag by writing to PMOVSCLR_EL0.)
aarch64/debug/pmu/AArch64.ClearEventCounters
// AArch64.ClearEventCounters()
// ============================
// Zero all the event counters.
AArch64.ClearEventCounters()
integer counters = AArch64.GetNumEventCountersAccessible();
if counters != 0 then
for idx = 0 to counters - 1
PMEVCNTR_EL0[idx] = Zeros();
aarch64/debug/pmu/AArch64.CountPMUEvents
// AArch64.CountPMUEvents()
// ========================
// Return TRUE if counter "idx" should count its event.
// For the cycle counter, idx == CYCLE_COUNTER_ID.
I1-300 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
// Event counting can be filtered by the {P, U, NSK, NSU, NSH} bits
filter = if idx == CYCLE_COUNTER_ID then PMCCFILTR_EL0<31:0> else PMEVTYPER_EL0[idx]<31:0>;
P = filter<31>;
U = filter<30>;
NSK = if HaveEL(EL3) then filter<29> else '0';
NSU = if HaveEL(EL3) then filter<28> else '0';
NSH = if HaveEL(EL2) then filter<27> else '0';
ss = CurrentSecurityState();
case PSTATE.EL of
when EL0 filtered = if ss == SS_Secure then U == '1' else U != NSU;
when EL1 filtered = if ss == SS_Secure then P == '1' else P != NSK;
when EL2 filtered = NSH == '0';
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-301
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/debug/pmu/AArch64.GetNumEventCountersAccessible
// AArch64.GetNumEventCountersAccessible()
// =======================================
// Return the number of event counters that can be accessed at the current Exception level.
integer AArch64.GetNumEventCountersAccessible()
integer n;
integer total_counters = GetNumEventCounters();
// Software can reserve some counters for EL2
if PSTATE.EL IN {EL1, EL0} && EL2Enabled() then
n = UInt(MDCR_EL2.HPMN);
if n > total_counters || n == 0 then
(-, n) = ConstrainUnpredictableInteger(0, total_counters,
Unpredictable_PMUEVENTCOUNTER);
else
n = total_counters;
return n;
aarch64/debug/pmu/AArch64.IncrementEventCounter
// AArch64.IncrementEventCounter()
// ===============================
// Increment the specified event counter by the specified amount.
PMEVCNTR_EL0[idx] = ZeroExtend(new_value<31:0>);
ovflw = 32;
aarch64/debug/pmu/AArch64.PMUCounterIsHyp
// AArch64.PMUCounterIsHyp
// =======================
// Returns TRUE if a counter is reserved for use by EL2, FALSE otherwise.
boolean AArch64.PMUCounterIsHyp(integer n)
boolean resvd_for_el2;
// Software can reserve some event counters for EL2
if n != CYCLE_COUNTER_ID && HaveEL(EL2) then
resvd_for_el2 = n >= UInt(MDCR_EL2.HPMN);
if UInt(MDCR_EL2.HPMN) > GetNumEventCounters() || IsZero(MDCR_EL2.HPMN) then
resvd_for_el2 = boolean UNKNOWN;
else
resvd_for_el2 = FALSE;
return resvd_for_el2;
I1-302 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/debug/pmu/AArch64.PMUCycle
// AArch64.PMUCycle()
// ==================
// Called at the end of each cycle to increment event counters and
// check for PMU overflow. In pseudocode, a cycle ends after the
// execution of the operational pseudocode.
AArch64.PMUCycle()
if !HavePMUv3() then
return;
PMUEvent(PMU_EVENT_CPU_CYCLES);
integer old_value;
integer new_value;
integer ovflw;
if (AArch64.CountPMUEvents(CYCLE_COUNTER_ID) &&
(!HaveAArch32() || PMCR_EL0.LC == '1' || PMCR_EL0.D == '0' || HasElapsed64Cycles())) then
old_value = UInt(PMCCNTR_EL0);
new_value = old_value + 1;
PMCCNTR_EL0 = new_value<63:0>;
if HaveAArch32() then
ovflw = if PMCR_EL0.LC == '1' then 64 else 32;
else
ovflw = 64;
AArch64.CheckForPMUOverflow();
aarch64/debug/pmu/AArch64.PMUSwIncrement
// AArch64.PMUSwIncrement()
// ========================
// Generate PMU Events on a write to PMSWINC_EL0.
AArch64.PMUSwIncrement(bits(32) sw_incr)
integer counters = AArch64.GetNumEventCountersAccessible();
if counters != 0 then
for idx = 0 to counters - 1
if sw_incr<idx> == '1' then
PMUEvent(PMU_EVENT_SW_INCR, 1, idx);
aarch64/debug/statisticalprofiling/TimeStamp
enumeration TimeStamp {
TimeStamp_None, // No timestamp
TimeStamp_CoreSight, // CoreSight time (IMPLEMENTATION DEFINED)
TimeStamp_Physical, // Physical counter value with no offset
TimeStamp_Virtual }; // Physical counter value minus CNTVOFF_EL2
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-303
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/debug/takeexceptiondbg/AArch64.TakeExceptionInDebugState
// AArch64.TakeExceptionInDebugState()
// ===================================
// Take an exception in Debug state to an Exception level using AArch64.
SynchronizeContext();
// If coming from AArch32 state, the top parts of the X[] registers might be set to zero
from_32 = UsingAArch32();
if from_32 then AArch64.MaybeZeroRegisterUppers();
AArch64.ReportException(exception, target_el);
PSTATE.EL = target_el;
PSTATE.nRW = '0';
PSTATE.SP = '1';
// PSTATE.{SS,D,A,I,F} are not observable and ignored in Debug state, so behave as if UNKNOWN.
PSTATE.<SS,D,A,I,F> = bits(5) UNKNOWN;
PSTATE.IL = '0';
if from_32 then // Coming from AArch32
PSTATE.IT = '00000000';
PSTATE.T = '0'; // PSTATE.J is RES0
if HavePANExt() && PSTATE.EL == EL1 && SCTLR_EL1.SPAN == '0' then
PSTATE.PAN = '1';
if HaveUAOExt() then PSTATE.UAO = '0';
if HaveSSBSExt() then PSTATE.SSBS = bit UNKNOWN;
EDSCR.ERR = '1';
UpdateEDSCRFields(); // Update EDSCR processor state flags.
if sync_errors then
SynchronizeErrors();
EndOfInstruction();
aarch64/debug/watchpoint/AArch64.WatchpointByteMatch
// AArch64.WatchpointByteMatch()
// =============================
I1-304 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
mask = UInt(DBGWCR_EL1[n].MASK);
// If the address mask is set to a reserved value, the behavior is CONSTRAINED UNPREDICTABLE.
if mask > 0 && mask <= 2 then
Constraint c;
(c, mask) = ConstrainUnpredictableInteger(3, 31);
assert c IN {Constraint_DISABLED, Constraint_NONE, Constraint_UNKNOWN};
case c of
when Constraint_DISABLED return FALSE; // Disabled
when Constraint_NONE mask = 0; // No masking
// Otherwise the value returned by ConstrainUnpredictableInteger is a not-reserved value
boolean WVR_match;
if mask > bottom then
// If the DBGxVR<n>_EL1.RESS field bits are not a sign extension of the MSB
// of DBGBVR<n>_EL1.VA, it is UNPREDICTABLE whether they appear to be
// included in the match.
if !IsOnes(DBGBVR_EL1[n]<63:top>) && !IsZero(DBGBVR_EL1[n]<63:top>) then
if ConstrainUnpredictableBool() then
top = 63;
WVR_match = (vaddress<top:mask> == DBGWVR_EL1[n]<top:mask>);
// If masked bits of DBGWVR_EL1[n] are not zero, the behavior is CONSTRAINED UNPREDICTABLE.
if WVR_match && !IsZero(DBGWVR_EL1[n]<mask-1:bottom>) then
WVR_match = ConstrainUnpredictableBool();
else
WVR_match = vaddress<top:bottom> == DBGWVR_EL1[n]<top:bottom>;
aarch64/debug/watchpoint/AArch64.WatchpointMatch
// AArch64.WatchpointMatch()
// =========================
// Watchpoint matching in an AArch64 translation regime.
// "ispriv" is:
// * FALSE for all loads, stores, and atomic operations executed at EL0.
// * FALSE if the access is unprivileged.
// * TRUE for all other loads, stores, and atomic operations.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-305
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
value_match = FALSE;
for byte = 0 to size - 1
value_match = value_match || AArch64.WatchpointByteMatch(n, vaddress + byte);
I1.1.2 aarch64/exceptions
This section includes the following pseudocode functions:
• aarch64/exceptions/aborts/AArch64.Abort on page I1-307.
• aarch64/exceptions/aborts/AArch64.AbortSyndrome on page I1-307.
• aarch64/exceptions/aborts/AArch64.CheckPCAlignment on page I1-307.
• aarch64/exceptions/aborts/AArch64.DataAbort on page I1-308.
• aarch64/exceptions/aborts/AArch64.InstructionAbort on page I1-308.
• aarch64/exceptions/aborts/AArch64.PCAlignmentFault on page I1-308.
• aarch64/exceptions/aborts/AArch64.SPAlignmentFault on page I1-309.
• aarch64/exceptions/async/AArch64.TakePhysicalFIQException on page I1-309.
• aarch64/exceptions/async/AArch64.TakePhysicalIRQException on page I1-309.
• aarch64/exceptions/async/AArch64.TakePhysicalSErrorException on page I1-310.
• aarch64/exceptions/async/AArch64.TakeVirtualFIQException on page I1-310.
• aarch64/exceptions/async/AArch64.TakeVirtualIRQException on page I1-310.
• aarch64/exceptions/async/AArch64.TakeVirtualSErrorException on page I1-311.
• aarch64/exceptions/debug/AArch64.BreakpointException on page I1-311.
• aarch64/exceptions/debug/AArch64.SoftwareBreakpoint on page I1-311.
• aarch64/exceptions/debug/AArch64.SoftwareStepException on page I1-312.
• aarch64/exceptions/debug/AArch64.VectorCatchException on page I1-312.
• aarch64/exceptions/debug/AArch64.WatchpointException on page I1-312.
• aarch64/exceptions/exceptions/AArch64.ExceptionClass on page I1-313.
• aarch64/exceptions/exceptions/AArch64.ReportException on page I1-314.
• aarch64/exceptions/exceptions/AArch64.ResetControlRegisters on page I1-314.
• aarch64/exceptions/exceptions/AArch64.TakeReset on page I1-314.
• aarch64/exceptions/ieeefp/AArch64.FPTrappedException on page I1-315.
• aarch64/exceptions/syscalls/AArch64.CallHypervisor on page I1-316.
• aarch64/exceptions/syscalls/AArch64.CallSecureMonitor on page I1-316.
• aarch64/exceptions/syscalls/AArch64.CallSupervisor on page I1-316.
• aarch64/exceptions/takeexception/AArch64.TakeException on page I1-317.
• aarch64/exceptions/traps/AArch64.AdvSIMDFPAccessTrap on page I1-318.
• aarch64/exceptions/traps/AArch64.CheckCP15InstrCoarseTraps on page I1-318.
• aarch64/exceptions/traps/AArch64.CheckFPAdvSIMDEnabled on page I1-319.
• aarch64/exceptions/traps/AArch64.CheckFPAdvSIMDTrap on page I1-319.
• aarch64/exceptions/traps/AArch64.CheckFPEnabled on page I1-319.
• aarch64/exceptions/traps/AArch64.CheckForSMCUndefOrTrap on page I1-319.
• aarch64/exceptions/traps/AArch64.CheckForWFxTrap on page I1-320.
• aarch64/exceptions/traps/AArch64.CheckIllegalState on page I1-320.
• aarch64/exceptions/traps/AArch64.MonitorModeTrap on page I1-320.
• aarch64/exceptions/traps/AArch64.SystemAccessTrap on page I1-320.
• aarch64/exceptions/traps/AArch64.SystemAccessTrapSyndrome on page I1-321.
• aarch64/exceptions/traps/AArch64.UndefinedFault on page I1-321.
I1-306 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/exceptions/aborts/AArch64.Abort
// AArch64.Abort()
// ===============
// Abort and Debug exception handling in an AArch64 translation regime.
if IsDebugException(fault) then
if fault.acctype == AccType_IFETCH then
if UsingAArch32() && fault.debugmoe == DebugException_VectorCatch then
AArch64.VectorCatchException(fault);
else
AArch64.BreakpointException(fault);
else
AArch64.WatchpointException(vaddress, fault);
elsif fault.acctype == AccType_IFETCH then
AArch64.InstructionAbort(vaddress, fault);
else
AArch64.DataAbort(vaddress, fault);
aarch64/exceptions/aborts/AArch64.AbortSyndrome
// AArch64.AbortSyndrome()
// =======================
// Creates an exception syndrome record for Abort and Watchpoint exceptions
// from an AArch64 translation regime.
return exception;
aarch64/exceptions/aborts/AArch64.CheckPCAlignment
// AArch64.CheckPCAlignment()
// ==========================
AArch64.CheckPCAlignment()
bits(64) pc = ThisInstrAddr();
if pc<1:0> != '00' then
AArch64.PCAlignmentFault();
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-307
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/exceptions/aborts/AArch64.DataAbort
// AArch64.DataAbort()
// ===================
aarch64/exceptions/aborts/AArch64.InstructionAbort
// AArch64.InstructionAbort()
// ==========================
ExceptionRecord exception;
bits(64) preferred_exception_return = ThisInstrAddr();
vect_offset = 0x0;
aarch64/exceptions/aborts/AArch64.PCAlignmentFault
// AArch64.PCAlignmentFault()
// ==========================
// Called on unaligned program counter in AArch64 state.
AArch64.PCAlignmentFault()
exception = ExceptionSyndrome(Exception_PCAlignment);
exception.vaddress = ThisInstrAddr();
I1-308 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/exceptions/aborts/AArch64.SPAlignmentFault
// AArch64.SPAlignmentFault()
// ==========================
// Called on an unaligned stack pointer in AArch64 state.
AArch64.SPAlignmentFault()
exception = ExceptionSyndrome(Exception_SPAlignment);
aarch64/exceptions/async/AArch64.TakePhysicalFIQException
// AArch64.TakePhysicalFIQException()
// ==================================
AArch64.TakePhysicalFIQException()
route_to_el3 = FALSE;
route_to_el2 = (PSTATE.EL IN {EL0, EL1} && EL2Enabled() &&
(HCR_EL2.TGE == '1' || HCR_EL2.FMO == '1'));
bits(64) preferred_exception_return = ThisInstrAddr();
vect_offset = 0x100;
exception = ExceptionSyndrome(Exception_FIQ);
if route_to_el3 then
AArch64.TakeException(EL3, exception, preferred_exception_return, vect_offset);
elsif PSTATE.EL == EL2 || route_to_el2 then
assert PSTATE.EL != EL3;
AArch64.TakeException(EL2, exception, preferred_exception_return, vect_offset);
else
assert PSTATE.EL IN {EL0, EL1};
AArch64.TakeException(EL1, exception, preferred_exception_return, vect_offset);
aarch64/exceptions/async/AArch64.TakePhysicalIRQException
// AArch64.TakePhysicalIRQException()
// ==================================
// Take an enabled physical IRQ exception.
AArch64.TakePhysicalIRQException()
route_to_el3 = FALSE;
route_to_el2 = (PSTATE.EL IN {EL0, EL1} && EL2Enabled() &&
(HCR_EL2.TGE == '1' || HCR_EL2.IMO == '1'));
bits(64) preferred_exception_return = ThisInstrAddr();
vect_offset = 0x80;
exception = ExceptionSyndrome(Exception_IRQ);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-309
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
if route_to_el3 then
AArch64.TakeException(EL3, exception, preferred_exception_return, vect_offset);
elsif PSTATE.EL == EL2 || route_to_el2 then
assert PSTATE.EL != EL3;
AArch64.TakeException(EL2, exception, preferred_exception_return, vect_offset);
else
assert PSTATE.EL IN {EL0, EL1};
AArch64.TakeException(EL1, exception, preferred_exception_return, vect_offset);
aarch64/exceptions/async/AArch64.TakePhysicalSErrorException
// AArch64.TakePhysicalSErrorException()
// =====================================
AArch64.TakePhysicalSErrorException(bits(25) syndrome)
route_to_el3 = FALSE;
route_to_el2 = (PSTATE.EL IN {EL0, EL1} && EL2Enabled() &&
(HCR_EL2.TGE == '1' || HCR_EL2.AMO == '1'));
bits(64) preferred_exception_return = ThisInstrAddr();
vect_offset = 0x180;
bits(2) target_el;
if PSTATE.EL == EL2 || route_to_el2 then
target_el = EL2;
else
target_el = EL1;
exception = ExceptionSyndrome(Exception_SError);
exception.syndrome = syndrome;
AArch64.TakeException(target_el, exception, preferred_exception_return, vect_offset);
aarch64/exceptions/async/AArch64.TakeVirtualFIQException
// AArch64.TakeVirtualFIQException()
// =================================
AArch64.TakeVirtualFIQException()
assert PSTATE.EL IN {EL0, EL1} && EL2Enabled();
assert HCR_EL2.TGE == '0' && HCR_EL2.FMO == '1'; // Virtual IRQ enabled if TGE==0 and FMO==1
exception = ExceptionSyndrome(Exception_FIQ);
aarch64/exceptions/async/AArch64.TakeVirtualIRQException
// AArch64.TakeVirtualIRQException()
// =================================
AArch64.TakeVirtualIRQException()
assert PSTATE.EL IN {EL0, EL1} && EL2Enabled();
assert HCR_EL2.TGE == '0' && HCR_EL2.IMO == '1'; // Virtual IRQ enabled if TGE==0 and IMO==1
I1-310 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
exception = ExceptionSyndrome(Exception_IRQ);
aarch64/exceptions/async/AArch64.TakeVirtualSErrorException
// AArch64.TakeVirtualSErrorException()
// ====================================
AArch64.TakeVirtualSErrorException(bits(25) syndrome)
if HaveRASExt() then
exception.syndrome<24> = VSESR_EL2.IDS;
exception.syndrome<23:0> = VSESR_EL2.ISS;
else
impdef_syndrome = syndrome<24> == '1';
if impdef_syndrome then exception.syndrome = syndrome;
ClearPendingVirtualSError();
AArch64.TakeException(EL1, exception, preferred_exception_return, vect_offset);
aarch64/exceptions/debug/AArch64.BreakpointException
// AArch64.BreakpointException()
// =============================
AArch64.BreakpointException(FaultRecord fault)
assert PSTATE.EL != EL3;
aarch64/exceptions/debug/AArch64.SoftwareBreakpoint
// AArch64.SoftwareBreakpoint()
// ============================
AArch64.SoftwareBreakpoint(bits(16) immediate)
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-311
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
exception = ExceptionSyndrome(Exception_SoftwareBreakpoint);
exception.syndrome<15:0> = immediate;
aarch64/exceptions/debug/AArch64.SoftwareStepException
// AArch64.SoftwareStepException()
// ===============================
AArch64.SoftwareStepException()
assert PSTATE.EL != EL3;
exception = ExceptionSyndrome(Exception_SoftwareStep);
if SoftwareStep_DidNotStep() then
exception.syndrome<24> = '0';
else
exception.syndrome<24> = '1';
exception.syndrome<6> = if SoftwareStep_SteppedEX() then '1' else '0';
exception.syndrome<5:0> = '100010'; // IFSC = Debug Exception
aarch64/exceptions/debug/AArch64.VectorCatchException
// AArch64.VectorCatchException()
// ==============================
// Vector Catch taken from EL0 or EL1 to EL2. This can only be called when debug exceptions are
// being routed to EL2, as Vector Catch is a legacy debug event.
AArch64.VectorCatchException(FaultRecord fault)
assert PSTATE.EL != EL2;
assert EL2Enabled() && (HCR_EL2.TGE == '1' || MDCR_EL2.TDE == '1');
aarch64/exceptions/debug/AArch64.WatchpointException
// AArch64.WatchpointException()
// =============================
I1-312 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/exceptions/exceptions/AArch64.ExceptionClass
// AArch64.ExceptionClass()
// ========================
// Returns the Exception Class and Instruction Length fields to be reported in ESR
il_is_valid = TRUE;
from_32 = UsingAArch32();
integer ec;
case exceptype of
when Exception_Uncategorized ec = 0x00; il_is_valid = FALSE;
when Exception_WFxTrap ec = 0x01;
when Exception_CP15RTTrap ec = 0x03; assert from_32;
when Exception_CP15RRTTrap ec = 0x04; assert from_32;
when Exception_CP14RTTrap ec = 0x05; assert from_32;
when Exception_CP14DTTrap ec = 0x06; assert from_32;
when Exception_AdvSIMDFPAccessTrap ec = 0x07;
when Exception_FPIDTrap ec = 0x08;
when Exception_PACTrap ec = 0x09;
when Exception_CP14RRTTrap ec = 0x0C; assert from_32;
when Exception_IllegalState ec = 0x0E; il_is_valid = FALSE;
when Exception_SupervisorCall ec = 0x11;
when Exception_HypervisorCall ec = 0x12;
when Exception_MonitorCall ec = 0x13;
when Exception_SystemRegisterTrap ec = 0x18; assert !from_32;
when Exception_PACFail ec = 0x1C; assert !from_32;
when Exception_InstructionAbort ec = 0x20; il_is_valid = FALSE;
when Exception_PCAlignment ec = 0x22; il_is_valid = FALSE;
when Exception_DataAbort ec = 0x24;
when Exception_SPAlignment ec = 0x26; il_is_valid = FALSE; assert !from_32;
when Exception_FPTrappedException ec = 0x28;
when Exception_SError ec = 0x2F; il_is_valid = FALSE;
when Exception_Breakpoint ec = 0x30; il_is_valid = FALSE;
when Exception_SoftwareStep ec = 0x32; il_is_valid = FALSE;
when Exception_Watchpoint ec = 0x34; il_is_valid = FALSE;
when Exception_SoftwareBreakpoint ec = 0x38;
when Exception_VectorCatch ec = 0x3A; il_is_valid = FALSE; assert from_32;
otherwise Unreachable();
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-313
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return (ec,il);
aarch64/exceptions/exceptions/AArch64.ReportException
// AArch64.ReportException()
// =========================
// Report syndrome information for exception taken to AArch64 state.
// IL is not valid for Data Abort exceptions without valid instruction syndrome information
if ec IN {0x24,0x25} && iss<24> == '0' then
il = '1';
if exceptype IN {
Exception_InstructionAbort,
Exception_PCAlignment,
Exception_DataAbort,
Exception_Watchpoint
} then
FAR[target_el] = exception.vaddress;
else
FAR[target_el] = bits(64) UNKNOWN;
if exception.ipavalid then
HPFAR_EL2<43:4> = exception.ipaddress<51:12>;
if IsSecureEL2Enabled() && CurrentSecurityState() == SS_Secure then
HPFAR_EL2.NS = exception.NS;
else
HPFAR_EL2.NS = '0';
elsif target_el == EL2 then
HPFAR_EL2<43:4> = bits(40) UNKNOWN;
return;
aarch64/exceptions/exceptions/AArch64.ResetControlRegisters
// Resets System registers and memory-mapped control registers that have architecturally-defined
// reset values to those values.
AArch64.ResetControlRegisters(boolean cold_reset);
aarch64/exceptions/exceptions/AArch64.TakeReset
// AArch64.TakeReset()
// ===================
// Reset into AArch64 state
AArch64.TakeReset(boolean cold_reset)
assert HaveAArch64();
I1-314 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
if HaveEL(EL3) then
PSTATE.EL = EL3;
elsif HaveEL(EL2) then
PSTATE.EL = EL2;
else
PSTATE.EL = EL1;
// All registers, bits and fields not reset by the above pseudocode or by the BranchTo() call
// below are UNKNOWN bitstrings after reset. In particular, the return information registers
// ELR_ELx and SPSR_ELx have UNKNOWN values, so that it
// is impossible to return from a reset in an architecturally defined way.
AArch64.ResetGeneralRegisters();
AArch64.ResetSIMDFPRegisters();
AArch64.ResetSpecialRegisters();
ResetExternalDebugRegisters(cold_reset);
rv = RVBAR_EL2;
aarch64/exceptions/ieeefp/AArch64.FPTrappedException
// AArch64.FPTrappedException()
// ============================
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-315
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
else
AArch64.TakeException(EL1, exception, preferred_exception_return, vect_offset);
aarch64/exceptions/syscalls/AArch64.CallHypervisor
// AArch64.CallHypervisor()
// ========================
// Performs a HVC call
AArch64.CallHypervisor(bits(16) immediate)
assert HaveEL(EL2);
exception = ExceptionSyndrome(Exception_HypervisorCall);
exception.syndrome<15:0> = immediate;
aarch64/exceptions/syscalls/AArch64.CallSecureMonitor
// AArch64.CallSecureMonitor()
// ===========================
AArch64.CallSecureMonitor(bits(16) immediate)
assert HaveEL(EL3) && !ELUsingAArch32(EL3);
if UsingAArch32() then AArch32.ITAdvance();
SSAdvance();
bits(64) preferred_exception_return = NextInstrAddr();
vect_offset = 0x0;
exception = ExceptionSyndrome(Exception_MonitorCall);
exception.syndrome<15:0> = immediate;
aarch64/exceptions/syscalls/AArch64.CallSupervisor
// AArch64.CallSupervisor()
// ========================
// Calls the Supervisor
AArch64.CallSupervisor(bits(16) immediate_in)
bits(16) immediate = immediate_in;
if UsingAArch32() then AArch32.ITAdvance();
SSAdvance();
route_to_el2 = PSTATE.EL == EL0 && EL2Enabled() && HCR_EL2.TGE == '1';
exception = ExceptionSyndrome(Exception_SupervisorCall);
exception.syndrome<15:0> = immediate;
I1-316 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/exceptions/takeexception/AArch64.TakeException
// AArch64.TakeException()
// =======================
// Take an exception to an Exception level using AArch64.
SynchronizeContext();
// If coming from AArch32 state, the top parts of the X[] registers might be set to zero
from_32 = UsingAArch32();
if from_32 then AArch64.MaybeZeroRegisterUppers();
PSTATE.EL = target_el;
PSTATE.nRW = '0';
PSTATE.SP = '1';
SPSR[] = spsr;
ELR[] = preferred_exception_return;
PSTATE.SS = '0';
PSTATE.<D,A,I,F> = '1111';
PSTATE.IL = '0';
if from_32 then // Coming from AArch32
PSTATE.IT = '00000000';
PSTATE.T = '0'; // PSTATE.J is RES0
if HavePANExt() && PSTATE.EL == EL1 && SCTLR_EL1.SPAN == '0' then
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-317
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
PSTATE.PAN = '1';
if HaveUAOExt() then PSTATE.UAO = '0';
if HaveSSBSExt() then PSTATE.SSBS = SCTLR[].DSSBS;
if sync_errors then
SynchronizeErrors();
iesb_req = TRUE;
TakeUnmaskedPhysicalSErrorInterrupts(iesb_req);
EndOfInstruction();
aarch64/exceptions/traps/AArch64.AdvSIMDFPAccessTrap
// AArch64.AdvSIMDFPAccessTrap()
// =============================
// Trapped access to Advanced SIMD or FP registers due to CPACR[].
AArch64.AdvSIMDFPAccessTrap(bits(2) target_el)
bits(64) preferred_exception_return = ThisInstrAddr();
ExceptionRecord exception;
vect_offset = 0x0;
if route_to_el2 then
exception = ExceptionSyndrome(Exception_Uncategorized);
AArch64.TakeException(EL2, exception, preferred_exception_return, vect_offset);
else
exception = ExceptionSyndrome(Exception_AdvSIMDFPAccessTrap);
exception.syndrome<24:20> = ConditionSyndrome();
AArch64.TakeException(target_el, exception, preferred_exception_return, vect_offset);
return;
aarch64/exceptions/traps/AArch64.CheckCP15InstrCoarseTraps
// AArch64.CheckCP15InstrCoarseTraps()
// ===================================
// Check for coarse-grained AArch32 traps to System registers in the
// coproc=0b1111 encoding space by HSTR_EL2 and HCR_EL2.
I1-318 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/exceptions/traps/AArch64.CheckFPAdvSIMDEnabled
// AArch64.CheckFPAdvSIMDEnabled()
// ===============================
AArch64.CheckFPAdvSIMDEnabled()
AArch64.CheckFPEnabled();
aarch64/exceptions/traps/AArch64.CheckFPAdvSIMDTrap
// AArch64.CheckFPAdvSIMDTrap()
// ============================
// Check against CPTR_EL2 and CPTR_EL3.
AArch64.CheckFPAdvSIMDTrap()
if PSTATE.EL IN {EL0, EL1, EL2} && EL2Enabled() then
// Check if access disabled in CPTR_EL2
if CPTR_EL2.TFP == '1' then AArch64.AdvSIMDFPAccessTrap(EL2);
aarch64/exceptions/traps/AArch64.CheckFPEnabled
// AArch64.CheckFPEnabled()
// ========================
// Check against CPACR[]
AArch64.CheckFPEnabled()
if PSTATE.EL IN {EL0, EL1} then
// Check if access disabled in CPACR_EL1
boolean disabled;
case CPACR_EL1.FPEN of
when 'x0' disabled = TRUE;
when '01' disabled = PSTATE.EL == EL0;
when '11' disabled = FALSE;
if disabled then AArch64.AdvSIMDFPAccessTrap(EL1);
aarch64/exceptions/traps/AArch64.CheckForSMCUndefOrTrap
// AArch64.CheckForSMCUndefOrTrap()
// ================================
// Check for UNDEFINED or trap on SMC instruction
AArch64.CheckForSMCUndefOrTrap(bits(16) imm)
if PSTATE.EL == EL0 then UNDEFINED;
route_to_el2 = FALSE;
if !HaveEL(EL3) || PSTATE.EL == EL0 then
UNDEFINED;
route_to_el2 = PSTATE.EL == EL1 && EL2Enabled() && HCR_EL2.TSC == '1';
if route_to_el2 then
bits(64) preferred_exception_return = ThisInstrAddr();
vect_offset = 0x0;
exception = ExceptionSyndrome(Exception_MonitorCall);
exception.syndrome<15:0> = imm;
exception.trappedsyscallinst = TRUE;
AArch64.TakeException(EL2, exception, preferred_exception_return, vect_offset);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-319
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/exceptions/traps/AArch64.CheckForWFxTrap
// AArch64.CheckForWFxTrap()
// =========================
// Check for trap on WFE or WFI instruction
if trap then
AArch64.WFxTrap(wfxtype, target_el);
aarch64/exceptions/traps/AArch64.CheckIllegalState
// AArch64.CheckIllegalState()
// ===========================
// Check PSTATE.IL bit and generate Illegal Execution state exception if set.
AArch64.CheckIllegalState()
if PSTATE.IL == '1' then
route_to_el2 = PSTATE.EL == EL0 && EL2Enabled() && HCR_EL2.TGE == '1';
exception = ExceptionSyndrome(Exception_IllegalState);
aarch64/exceptions/traps/AArch64.MonitorModeTrap
// AArch64.MonitorModeTrap()
// =========================
// Trapped use of Monitor mode features in a Secure EL1 AArch32 mode
AArch64.MonitorModeTrap()
bits(64) preferred_exception_return = ThisInstrAddr();
vect_offset = 0x0;
exception = ExceptionSyndrome(Exception_Uncategorized);
if IsSecureEL2Enabled() then
AArch64.TakeException(EL2, exception, preferred_exception_return, vect_offset);
AArch64.TakeException(EL3, exception, preferred_exception_return, vect_offset);
aarch64/exceptions/traps/AArch64.SystemAccessTrap
// AArch64.SystemAccessTrap()
// ==========================
// Trapped access to AArch64 system register or system instruction.
I1-320 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/exceptions/traps/AArch64.SystemAccessTrapSyndrome
// AArch64.SystemAccessTrapSyndrome()
// ==================================
// Returns the syndrome information for traps on AArch64 MSR/MRS instructions.
return exception;
aarch64/exceptions/traps/AArch64.UndefinedFault
// AArch64.UndefinedFault()
// ========================
AArch64.UndefinedFault()
exception = ExceptionSyndrome(Exception_Uncategorized);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-321
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/exceptions/traps/AArch64.WFxTrap
// AArch64.WFxTrap()
// =================
exception = ExceptionSyndrome(Exception_WFxTrap);
exception.syndrome<24:20> = ConditionSyndrome();
case wfxtype of
when WFxType_WFI
exception.syndrome<0> = '0';
when WFxType_WFE
exception.syndrome<0> = '1';
aarch64/exceptions/traps/CheckFPAdvSIMDEnabled64
// CheckFPAdvSIMDEnabled64()
// =========================
// AArch64 instruction wrapper
CheckFPAdvSIMDEnabled64()
AArch64.CheckFPAdvSIMDEnabled();
aarch64/exceptions/traps/CheckFPEnabled64
// CheckFPEnabled64()
// ==================
// AArch64 instruction wrapper
CheckFPEnabled64()
AArch64.CheckFPEnabled();
I1.1.3 aarch64/functions
This section includes the following pseudocode functions:
• aarch64/functions/aborts/AArch64.FaultSyndrome on page I1-324.
• aarch64/functions/cache/AArch64.DataMemZero on page I1-325.
• aarch64/functions/exclusive/AArch64.ExclusiveMonitorsPass on page I1-325.
• aarch64/functions/exclusive/AArch64.IsExclusiveVA on page I1-326.
• aarch64/functions/exclusive/AArch64.MarkExclusiveVA on page I1-326.
• aarch64/functions/exclusive/AArch64.SetExclusiveMonitors on page I1-326.
• aarch64/functions/fusedrstep/FPRSqrtStepFused on page I1-326.
• aarch64/functions/fusedrstep/FPRecipStepFused on page I1-327.
• aarch64/functions/memory/AArch64.CheckAlignment on page I1-328.
• aarch64/functions/memory/AArch64.MemSingle on page I1-328.
• aarch64/functions/memory/AArch64.TranslateAddressForAtomicAccess on page I1-330.
• aarch64/functions/memory/CheckAllInAlignedQuantity on page I1-330.
I1-322 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-323
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/aborts/AArch64.FaultSyndrome
// AArch64.FaultSyndrome()
// =======================
// Creates an exception syndrome value for Abort and Watchpoint exceptions taken to
// an Exception level using AArch64.
if d_side then
if (IsSecondStage(fault) && !fault.s2fs1walk &&
(!IsExternalSyncAbort(fault) ||
(!HaveRASExt() && fault.acctype == AccType_TTW &&
boolean IMPLEMENTATION_DEFINED "ISV on second stage translation table walk"))) then
iss<24:14> = LSInstructionSyndrome();
I1-324 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return iss;
aarch64/functions/cache/AArch64.DataMemZero
// AArch64.DataMemZero()
// =====================
// Write Zero to data memory
aarch64/functions/exclusive/AArch64.ExclusiveMonitorsPass
// AArch64.ExclusiveMonitorsPass()
// ===============================
// Return TRUE if the Exclusives monitors for the current PE include all of the addresses
// associated with the virtual address region of size bytes starting at address.
// The immediately following memory write must be to the same addresses.
acctype = AccType_ATOMIC;
iswrite = TRUE;
if passed then
if memaddrdesc.memattrs.shareability != Shareability_NSH then
passed = IsExclusiveGlobal(memaddrdesc.paddress, ProcessorID(), size);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-325
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return passed;
aarch64/functions/exclusive/AArch64.IsExclusiveVA
// An optional IMPLEMENTATION DEFINED test for an exclusive access to a virtual
// address region of size bytes starting at address.
//
// It is permitted (but not required) for this function to return FALSE and
// cause a store exclusive to fail if the virtual address region is not
// totally included within the region recorded by MarkExclusiveVA().
//
// It is always safe to return TRUE which will check the physical address only.
boolean AArch64.IsExclusiveVA(bits(64) address, integer processorid, integer size);
aarch64/functions/exclusive/AArch64.MarkExclusiveVA
// Optionally record an exclusive access to the virtual address region of size bytes
// starting at address for processorid.
AArch64.MarkExclusiveVA(bits(64) address, integer processorid, integer size);
aarch64/functions/exclusive/AArch64.SetExclusiveMonitors
// AArch64.SetExclusiveMonitors()
// ==============================
// Sets the Exclusives monitors for the current PE to record the addresses associated
// with the virtual address region of size bytes starting at address.
aarch64/functions/fusedrstep/FPRSqrtStepFused
// FPRSqrtStepFused()
// ==================
I1-326 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
if !done then
inf1 = (type1 == FPType_Infinity);
inf2 = (type2 == FPType_Infinity);
zero1 = (type1 == FPType_Zero);
zero2 = (type2 == FPType_Zero);
return result;
aarch64/functions/fusedrstep/FPRecipStepFused
// FPRecipStepFused()
// ==================
if !done then
inf1 = (type1 == FPType_Infinity);
inf2 = (type2 == FPType_Infinity);
zero1 = (type1 == FPType_Zero);
zero2 = (type2 == FPType_Zero);
return result;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-327
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/memory/AArch64.CheckAlignment
// AArch64.CheckAlignment()
// ========================
return aligned;
aarch64/functions/memory/AArch64.MemSingle
// AArch64.MemSingle[] - non-assignment (read) form
// ================================================
// Perform an atomic, little-endian read of 'size' bytes.
bits(size*8) AArch64.MemSingle[bits(64) address, integer size, AccType acctype, boolean aligned, boolean
ispair]
assert size IN {1, 2, 4, 8, 16};
constant halfsize = size DIV 2;
if HaveLSE2Ext() then
assert CheckAllInAlignedQuantity(address, size, 16);
else
assert address == Align(address, size);
AddressDescriptor memaddrdesc;
bits(size*8) value;
iswrite = FALSE;
I1-328 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
if IsFault(memstatus) then
HandleExternalReadAbort(memstatus, memaddrdesc, size, accdesc);
elsif splitpair then
assert ispair;
bits(halfsize * 8) lowhalf, highhalf;
(memstatus, lowhalf) = PhysMemRead(memaddrdesc, halfsize, accdesc);
if IsFault(memstatus) then
HandleExternalReadAbort(memstatus, memaddrdesc, halfsize, accdesc);
memaddrdesc.paddress.address = memaddrdesc.paddress.address + halfsize;
(memstatus, highhalf) = PhysMemRead(memaddrdesc, halfsize, accdesc);
if IsFault(memstatus) then
HandleExternalReadAbort(memstatus, memaddrdesc, halfsize, accdesc);
value = highhalf:lowhalf;
else
for i = 0 to size-1
(memstatus, value<8*i+7:8*i>) = PhysMemRead(memaddrdesc, 1, accdesc);
if IsFault(memstatus) then
HandleExternalReadAbort(memstatus, memaddrdesc, 1, accdesc);
memaddrdesc.paddress.address = memaddrdesc.paddress.address + 1;
return value;
AArch64.MemSingle[bits(64) address, integer size, AccType acctype, boolean aligned] = bits(size*8) value
boolean ispair = FALSE;
AArch64.MemSingle[address, size, acctype, aligned, ispair] = value;
return;
AArch64.MemSingle[bits(64) address, integer size, AccType acctype, boolean aligned, boolean ispair] =
bits(size*8) value
assert size IN {1, 2, 4, 8, 16};
constant halfsize = size DIV 2;
if HaveLSE2Ext() then
assert CheckAllInAlignedQuantity(address, size, 16);
else
assert address == Align(address, size);
AddressDescriptor memaddrdesc;
iswrite = TRUE;
// Effect on exclusives
if memaddrdesc.memattrs.shareability != Shareability_NSH then
ClearExclusiveByAddress(memaddrdesc.paddress, ProcessorID(), size);
PhysMemRetStatus memstatus;
(atomic, splitpair) = CheckSingleAccessAttributes(address, memaddrdesc.memattrs, size, acctype,
iswrite, aligned, ispair);
if atomic then
memstatus = PhysMemWrite(memaddrdesc, size, accdesc, value);
if IsFault(memstatus) then
HandleExternalWriteAbort(memstatus, memaddrdesc, size, accdesc);
elsif splitpair then
assert ispair;
bits(halfsize*8) lowhalf, highhalf;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-329
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/memory/AArch64.TranslateAddressForAtomicAccess
// AArch64.TranslateAddressForAtomicAccess()
// =========================================
// Performs an alignment check for atomic memory operations.
// Also translates 64-bit Virtual Address into Physical Address.
// Effect on exclusives
if memaddrdesc.memattrs.shareability != Shareability_NSH then
ClearExclusiveByAddress(memaddrdesc.paddress, ProcessorID(), size);
return memaddrdesc;
aarch64/functions/memory/CheckAllInAlignedQuantity
// CheckAllInAlignedQuantity()
// ===========================
// Returns TRUE if all accessed bytes are within one aligned quantity, FALSE otherwise.
aarch64/functions/memory/CheckSPAlignment
// CheckSPAlignment()
// ==================
// Check correct stack pointer alignment for AArch64 state.
CheckSPAlignment()
I1-330 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
bits(64) sp = SP[];
boolean stack_align_check;
if PSTATE.EL == EL0 then
stack_align_check = (SCTLR[].SA0 != '0');
else
stack_align_check = (SCTLR[].SA != '0');
return;
aarch64/functions/memory/CheckSingleAccessAttributes
// CheckSingleAccessAttributes()
// =============================
//
// When FEAT_LSE2 is implemented, a MemSingle[] access needs to be further assessed once the memory
// attributes are determined.
// If it was aligned to access size or targets Normal Inner Write-Back, Outer Write-Back Cacheable
// memory then it is single copy atomic and there is no alignment fault.
// If not, for exclusives, atomics and non atomic acquire release instructions - it is CONSTRAINED
UNPREDICTABLE
// if they generate an alignment fault. If they do not generate an alignement fault - they are
// single copy atomic.
// Otherwise it is IMPLEMENTATION DEFINED - if they are single copy atomic.
//
// The function returns (atomic, splitpair), where
// atomic indicates if the access is single copy atomic.
// splitpair indicates that a load/store pair is split into 2 single copy atomic accesses.
// when atomic and splitpair are both FALSE - the access is not single copy atomic and may be
treated
// as byte accesses.
atomic = TRUE;
splitpair = FALSE;
if isnormalwb then return (atomic, splitpair);
if aligned then
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-331
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
atomic = boolean IMPLEMENTATION_DEFINED "Misaligned accesses within 16 byte aligned memory but not
Normal Cacheable Writeback are Atomic";
aarch64/functions/memory/Mem
// Mem[] - non-assignment (read) form
// ==================================
// Perform a read of 'size' bytes. The access byte order is reversed for a big-endian access.
// Instruction fetches would call AArch64.MemSingle directly.
I1-332 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
for i = 1 to size-1
value<8*i+7:8*i> = AArch64.MemSingle[address+i, 1, acctype, aligned];
elsif size == 16 && acctype IN {AccType_VEC, AccType_VECSTREAM} then
lowhalf = AArch64.MemSingle[address, halfsize, acctype, aligned, ispair];
highhalf = AArch64.MemSingle[address + halfsize, halfsize, acctype, aligned, ispair];
value = highhalf:lowhalf;
else
value = AArch64.MemSingle[address, size, acctype, aligned, ispair];
if BigEndian(acctype) then
value = BigEndianReverse(value);
return value;
Mem[bits(64) address, integer size, AccType acctype, boolean ispair] = bits(size*8) value_in
boolean iswrite = TRUE;
constant halfsize = size DIV 2;
bits(size*8) value = value_in;
bits(halfsize*8) lowhalf, highhalf;
boolean atomic;
boolean aligned;
if BigEndian(acctype) then
value = BigEndianReverse(value);
if ispair then
// check alignment on size of element accessed, not overall access size
aligned = AArch64.CheckAlignment(address, halfsize, acctype, iswrite);
else
aligned = AArch64.CheckAlignment(address, size, acctype, iswrite);
if ispair then
atomic = CheckAllInAlignedQuantity(address, size, 16);
elsif size != 16 || !(acctype IN {AccType_VEC, AccType_VECSTREAM}) then
if !HaveLSE2Ext() then
atomic = aligned;
else
atomic = CheckAllInAlignedQuantity(address, size, 16);
elsif (acctype IN {AccType_VEC, AccType_VECSTREAM}) then
// 128-bit SIMD&FP stores are treated as a pair of 64-bit single-copy atomic accesses
// 64-bit aligned.
atomic = address == Align(address, 8);
else
// 16-byte integer access
atomic = address == Align(address, 16);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-333
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
for i = 1 to size-1
AArch64.MemSingle[address+i, 1, acctype, aligned] = value<8*i+7:8*i>;
elsif size == 16 && acctype IN {AccType_VEC, AccType_VECSTREAM} then
<highhalf, lowhalf> = value;
AArch64.MemSingle[address, halfsize, acctype, aligned, ispair] = lowhalf;
AArch64.MemSingle[address + halfsize, halfsize, acctype, aligned, ispair] = highhalf;
else
AArch64.MemSingle[address, size, acctype, aligned, ispair] = value;
return;
aarch64/functions/memory/MemAtomic
// MemAtomic()
// ===========
// Performs load and store memory operations for a given virtual address.
bits(size) MemAtomic(bits(64) address, MemAtomicOp op, bits(size) value, AccType ldacctype, AccType
stacctype)
bits(size) newvalue;
memaddrdesc = AArch64.TranslateAddressForAtomicAccess(address, size);
ldaccdesc = CreateAccessDescriptor(ldacctype);
staccdesc = CreateAccessDescriptor(stacctype);
case op of
when MemAtomicOp_ADD newvalue = oldvalue + value;
when MemAtomicOp_BIC newvalue = oldvalue AND NOT(value);
when MemAtomicOp_EOR newvalue = oldvalue EOR value;
when MemAtomicOp_ORR newvalue = oldvalue OR value;
when MemAtomicOp_SMAX newvalue = if SInt(oldvalue) > SInt(value) then oldvalue else value;
when MemAtomicOp_SMIN newvalue = if SInt(oldvalue) > SInt(value) then value else oldvalue;
when MemAtomicOp_UMAX newvalue = if UInt(oldvalue) > UInt(value) then oldvalue else value;
when MemAtomicOp_UMIN newvalue = if UInt(oldvalue) > UInt(value) then value else oldvalue;
when MemAtomicOp_SWP newvalue = value;
if BigEndian(stacctype) then
newvalue = BigEndianReverse(newvalue);
memstatus = PhysMemWrite(memaddrdesc, size DIV 8, staccdesc, newvalue);
if IsFault(memstatus) then
HandleExternalWriteAbort(memstatus, memaddrdesc, size DIV 8, staccdesc);
aarch64/functions/memory/MemAtomicCompareAndSwap
// MemAtomicCompareAndSwap()
// =========================
// Compares the value stored at the passed-in memory address against the passed-in expected
// value. If the comparison is successful, the value at the passed-in memory address is swapped
// with the passed-in new_value.
I1-334 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/pac/addpac/AddPAC
// AddPAC()
// ========
// Calculates the pointer authentication code for a 64-bit quantity and then
// inserts that into pointer authentication code field of that 64-bit quantity.
// If tagged pointers are in use for a regime with two TTBRs, use bit<55> of
// the pointer to select between upper and lower ranges, and preserve this.
// This handles the awkward case where there is apparently no correct choice between
// the upper and lower address range - ie an addr of 1xxxxxxx0... with TBI0=0 and TBI1=1
// and 0xxxxxxx1 with TBI1=0 and TBI0=1:
// This include EL1/EL0 in both VMSA and PMSA context.
if PSTATE.EL == EL1 || PSTATE.EL == EL0 then
assert S1TranslationRegime() == EL1;
if S1TranslationRegime() == EL1 then
// EL1 translation regime registers
if data then
if TCR_EL1.TBI1 == '1' || TCR_EL1.TBI0 == '1' then
selbit = ptr<55>;
else
selbit = ptr<63>;
else
if ((TCR_EL1.TBI1 == '1' && TCR_EL1.TBID1 == '0') ||
(TCR_EL1.TBI0 == '1' && TCR_EL1.TBID0 == '0')) then
selbit = ptr<55>;
else
selbit = ptr<63>;
else selbit = if tbi then ptr<55> else ptr<63>;
// The pointer authentication code field takes all the available bits in between
extfield = Replicate(selbit, 64);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-335
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
// Compute the pointer authentication code for a ptr with good extension bits
if tbi then
ext_ptr = ptr<63:56>:extfield<(56-bottom_PAC_bit)-1:0>:ptr<bottom_PAC_bit-1:0>;
else
ext_ptr = extfield<(64-bottom_PAC_bit)-1:0>:ptr<bottom_PAC_bit-1:0>;
// Check if the ptr has good extension bits and corrupt the pointer authentication code if not
if !IsZero(ptr<top_bit:bottom_PAC_bit>) && !IsOnes(ptr<top_bit:bottom_PAC_bit>) then
if HaveEnhancedPAC() then
PAC = 0x0000000000000000<63:0>;
elsif !HaveEnhancedPAC2() then
PAC<top_bit-1> = NOT(PAC<top_bit-1>);
// preserve the determination between upper and lower address at bit<55> and insert PAC
if !HaveEnhancedPAC2() then
if tbi then
result = ptr<63:56>:selbit:PAC<54:bottom_PAC_bit>:ptr<bottom_PAC_bit-1:0>;
else
result = PAC<63:56>:selbit:PAC<54:bottom_PAC_bit>:ptr<bottom_PAC_bit-1:0>;
else
if tbi then
result = ptr<63:56>:selbit:(ptr<54:bottom_PAC_bit> EOR
PAC<54:bottom_PAC_bit>):ptr<bottom_PAC_bit-1:0>;
else
result = (ptr<63:56> EOR PAC<63:56>):selbit:(ptr<54:bottom_PAC_bit> EOR
PAC<54:bottom_PAC_bit>):ptr<bottom_PAC_bit-1:0>;
return result;
aarch64/functions/pac/addpacda/AddPACDA
// AddPACDA()
// ==========
// Returns a 64-bit value containing X, but replacing the pointer authentication code
// field bits with a pointer authentication code, where the pointer authentication
// code is derived using a cryptographic algorithm as a combination of X, Y and the
// APDAKey_EL1.
I1-336 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/pac/addpacdb/AddPACDB
// AddPACDB()
// ==========
// Returns a 64-bit value containing X, but replacing the pointer authentication code
// field bits with a pointer authentication code, where the pointer authentication
// code is derived using a cryptographic algorithm as a combination of X, Y and the
// APDBKey_EL1.
aarch64/functions/pac/addpacga/AddPACGA
// AddPACGA()
// ==========
// Returns a 64-bit value where the lower 32 bits are 0, and the upper 32 bits contain
// a 32-bit pointer authentication code which is derived using a cryptographic
// algorithm as a combination of X, Y and the APGAKey_EL1.
if TrapEL2 then
TrapPACUse(EL2);
else
return ComputePAC(X, Y, APGAKey_EL1<127:64>, APGAKey_EL1<63:0>)<63:32>:Zeros(32);
aarch64/functions/pac/addpacia/AddPACIA
// AddPACIA()
// ==========
// Returns a 64-bit value containing X, but replacing the pointer authentication code
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-337
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
// field bits with a pointer authentication code, where the pointer authentication
// code is derived using a cryptographic algorithm as a combination of X, Y, and the
// APIAKey_EL1.
APIAKey_EL1 = APIAKeyHi_EL1<63:0>:APIAKeyLo_EL1<63:0>;
if PSTATE.EL IN {EL0, EL1} then
assert S1TranslationRegime() == EL1;
Enable = SCTLR_EL1.EnIA;
TrapEL2 = HCR_EL2.API == '0';
elsif PSTATE.EL == EL2 then
Enable = SCTLR_EL2.EnIA;
TrapEL2 = FALSE;
else
Unreachable();
aarch64/functions/pac/addpacib/AddPACIB
// AddPACIB()
// ==========
// Returns a 64-bit value containing X, but replacing the pointer authentication code
// field bits with a pointer authentication code, where the pointer authentication
// code is derived using a cryptographic algorithm as a combination of X, Y and the
// APIBKey_EL1.
I1-338 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/pac/auth/AArch64.PACFailException
// AArch64.PACFailException()
// ==========================
// Generates a PAC Fail Exception
AArch64.PACFailException(bits(2) syndrome)
route_to_el2 = PSTATE.EL == EL0 && EL2Enabled() && HCR_EL2.TGE == '1';
bits(64) preferred_exception_return = ThisInstrAddr();
vect_offset = 0x0;
exception = ExceptionSyndrome(Exception_PACFail);
exception.syndrome<1:0> = syndrome;
exception.syndrome<24:2> = Zeros(); // RES0
aarch64/functions/pac/auth/Auth
// Auth()
// ======
// Restores the upper bits of the address to be all zeros or all ones (based on the
// value of bit[55]) and computes and checks the pointer authentication code. If the
// check passes, then the restored address is returned. If the check fails, the
// second-top and third-top bits of the extension bits in the pointer authentication code
// field are corrupted to ensure that accessing the address will give a translation fault.
bits(64) Auth(bits(64) ptr, bits(64) modifier, bits(128) K, boolean data, bit key_number,
boolean is_combined)
bits(64) PAC;
bits(64) result;
bits(64) original_ptr;
bits(2) error_code;
bits(64) extfield;
// Reconstruct the extension field used of adding the PAC to the pointer
boolean tbi = EffectiveTBI(ptr, !data, PSTATE.EL) == '1';
integer bottom_PAC_bit = CalculateBottomPACBit(ptr<55>);
extfield = Replicate(ptr<55>, 64);
if tbi then
original_ptr = ptr<63:56>:extfield<(56-bottom_PAC_bit)-1:0>:ptr<bottom_PAC_bit-1:0>;
else
original_ptr = extfield<(64-bottom_PAC_bit)-1:0>:ptr<bottom_PAC_bit-1:0>;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-339
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
else
if !HaveEnhancedPAC2() then
if PAC<54:bottom_PAC_bit> == ptr<54:bottom_PAC_bit> && PAC<63:56> == ptr<63:56> then
result = original_ptr;
else
error_code = key_number:NOT(key_number);
result = original_ptr<63>:error_code:original_ptr<60:0>;
else
result = ptr;
result<54:bottom_PAC_bit> = result<54:bottom_PAC_bit> EOR PAC<54:bottom_PAC_bit>;
result<63:56> = result<63:56> EOR PAC<63:56>;
if HaveFPACCombined() || (HaveFPAC() && !is_combined) then
if result<63:bottom_PAC_bit> != Replicate(result<55>, (64-bottom_PAC_bit)) then
error_code = (if data then '1' else '0'):key_number;
AArch64.PACFailException(error_code);
return result;
aarch64/functions/pac/authda/AuthDA
// AuthDA()
// ========
// Returns a 64-bit value containing X, but replacing the pointer authentication code
// field bits with the extension of the address bits. The instruction checks a pointer
// authentication code in the pointer authentication code field bits of X, using the same
// algorithm and key as AddPACDA().
aarch64/functions/pac/authdb/AuthDB
// AuthDB()
// ========
// Returns a 64-bit value containing X, but replacing the pointer authentication code
// field bits with the extension of the address bits. The instruction checks a
// pointer authentication code in the pointer authentication code field bits of X, using
// the same algorithm and key as AddPACDB().
I1-340 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/pac/authia/AuthIA
// AuthIA()
// ========
// Returns a 64-bit value containing X, but replacing the pointer authentication code
// field bits with the extension of the address bits. The instruction checks a pointer
// authentication code in the pointer authentication code field bits of X, using the same
// algorithm and key as AddPACIA().
aarch64/functions/pac/authib/AuthIB
// AuthIB()
// ========
// Returns a 64-bit value containing X, but replacing the pointer authentication code
// field bits with the extension of the address bits. The instruction checks a pointer
// authentication code in the pointer authentication code field bits of X, using the same
// algorithm and key as AddPACIB().
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-341
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
bits(1) Enable;
bits(128) APIBKey_EL1;
aarch64/functions/pac/calcbottompacbit/CalculateBottomPACBit
// CalculateBottomPACBit()
// =======================
if PtrHasUpperAndLowerAddRanges() then
assert S1TranslationRegime() == EL1;
tsz_field = if top_bit == '1' then UInt(TCR_EL1.T1SZ) else UInt(TCR_EL1.T0SZ);
using64k = if top_bit == '1' then TCR_EL1.TG1 == '11' else TCR_EL1.TG0 == '01';
aarch64/functions/pac/computepac/ComputePAC
// ComputePAC()
// ============
I1-342 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
integer iterations;
if HavePACQARMA3() then
iterations = 2;
RC[0] = 0x0000000000000000<63:0>;
RC[1] = 0x13198A2E03707344<63:0>;
RC[2] = 0xA4093822299F31D0<63:0>;
else
iterations = 4;
RC[0] = 0x0000000000000000<63:0>;
RC[1] = 0x13198A2E03707344<63:0>;
RC[2] = 0xA4093822299F31D0<63:0>;
RC[3] = 0x082EFA98EC4E6C89<63:0>;
RC[4] = 0x452821E638D01377<63:0>;
return workingval;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-343
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/pac/computepac/PACCellInvShuffle
// PACCellInvShuffle()
// ===================
aarch64/functions/pac/computepac/PACCellShuffle
// PACCellShuffle()
// ================
aarch64/functions/pac/computepac/PACInvSub
// PACInvSub()
// ===========
I1-344 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/pac/computepac/PACMult
// PACMult()
// =========
for i = 0 to 3
t0<3:0> = RotCell(Sinput<4*(i+8)+3:4*(i+8)>, 1) EOR RotCell(Sinput<4*(i+4)+3:4*(i+4)>, 2);
t0<3:0> = t0<3:0> EOR RotCell(Sinput<4*(i)+3:4*(i)>, 1);
t1<3:0> = RotCell(Sinput<4*(i+12)+3:4*(i+12)>, 1) EOR RotCell(Sinput<4*(i+4)+3:4*(i+4)>, 1);
t1<3:0> = t1<3:0> EOR RotCell(Sinput<4*(i)+3:4*(i)>, 2);
t2<3:0> = RotCell(Sinput<4*(i+12)+3:4*(i+12)>, 2) EOR RotCell(Sinput<4*(i+8)+3:4*(i+8)>, 1);
t2<3:0> = t2<3:0> EOR RotCell(Sinput<4*(i)+3:4*(i)>, 1);
t3<3:0> = RotCell(Sinput<4*(i+12)+3:4*(i+12)>, 1) EOR RotCell(Sinput<4*(i+8)+3:4*(i+8)>, 2);
t3<3:0> = t3<3:0> EOR RotCell(Sinput<4*(i+4)+3:4*(i+4)>, 1);
Soutput<4*i+3:4*i> = t3<3:0>;
Soutput<4*(i+4)+3:4*(i+4)> = t2<3:0>;
Soutput<4*(i+8)+3:4*(i+8)> = t1<3:0>;
Soutput<4*(i+12)+3:4*(i+12)> = t0<3:0>;
return Soutput;
aarch64/functions/pac/computepac/PACSub
// PACSub()
// ========
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-345
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/pac/computepac/PacSub1
// PacSub1()
// =========
aarch64/functions/pac/computepac/RC
array bits(64) RC[0..4];
aarch64/functions/pac/computepac/RotCell
// RotCell()
// =========
aarch64/functions/pac/computepac/TweakCellInvRot
// TweakCellInvRot()
// =================
I1-346 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/pac/computepac/TweakCellRot
// TweakCellRot()
// ==============
aarch64/functions/pac/computepac/TweakInvShuffle
// TweakInvShuffle()
// =================
aarch64/functions/pac/computepac/TweakShuffle
// TweakShuffle()
// ==============
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-347
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
outdata<63:60> = TweakCellRot(indata<39:36>);
return outdata;
aarch64/functions/pac/pac/ConstPACField
// ConstPACField()
// ===============
// Returns TRUE if bit<55> can be used to determine the size of the PAC field, FALSE otherwise.
boolean ConstPACField()
return boolean IMPLEMENTATION_DEFINED "Bit 55 determines the size of the PAC field";
aarch64/functions/pac/pac/HaveEnhancedPAC
// HaveEnhancedPAC()
// =================
// Returns TRUE if support for EnhancedPAC is implemented, FALSE otherwise.
boolean HaveEnhancedPAC()
return ( HavePACExt()
&& boolean IMPLEMENTATION_DEFINED "Has enhanced PAC functionality" );
aarch64/functions/pac/pac/HaveEnhancedPAC2
// HaveEnhancedPAC2()
// ==================
// Returns TRUE if support for EnhancedPAC2 is implemented, FALSE otherwise.
boolean HaveEnhancedPAC2()
return HasArchVersion(ARMv8p3) && boolean IMPLEMENTATION_DEFINED "Has enhanced PAC 2 functionality";
aarch64/functions/pac/pac/HaveFPAC
// HaveFPAC()
// ==========
// Returns TRUE if support for FPAC is implemented, FALSE otherwise.
boolean HaveFPAC()
return HaveEnhancedPAC2() && boolean IMPLEMENTATION_DEFINED "Has FPAC functionality";
aarch64/functions/pac/pac/HaveFPACCombined
// HaveFPACCombined()
// ==================
// Returns TRUE if support for FPACCombined is implemented, FALSE otherwise.
boolean HaveFPACCombined()
return HaveFPAC() && boolean IMPLEMENTATION_DEFINED "Has FPAC Combined functionality";
aarch64/functions/pac/pac/HavePACExt
// HavePACExt()
// ============
// Returns TRUE if support for the PAC extension is implemented, FALSE otherwise.
I1-348 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
boolean HavePACExt()
return HasArchVersion(ARMv8p3);
aarch64/functions/pac/pac/HavePACIMP
// HavePACIMP()
// ============
// Returns TRUE if support for PAC IMP is implemented, FALSE otherwise.
boolean HavePACIMP()
return HavePACExt() && boolean IMPLEMENTATION_DEFINED "Has PAC IMP functionality";
aarch64/functions/pac/pac/HavePACQARMA3
// HavePACQARMA3()
// ===============
// Returns TRUE if support for PAC QARMA3 is implemented, FALSE otherwise.
boolean HavePACQARMA3()
return HavePACExt() && boolean IMPLEMENTATION_DEFINED "Has PAC QARMA3 functionality";
aarch64/functions/pac/pac/HavePACQARMA5
// HavePACQARMA5()
// ===============
// Returns TRUE if support for PAC QARMA5 is implemented, FALSE otherwise.
boolean HavePACQARMA5()
return HavePACExt() && boolean IMPLEMENTATION_DEFINED "Has PAC QARMA5 functionality";
aarch64/functions/pac/pac/PtrHasUpperAndLowerAddRanges
// PtrHasUpperAndLowerAddRanges()
// ==============================
// Returns TRUE if the pointer has upper and lower address ranges, FALSE otherwise.
boolean PtrHasUpperAndLowerAddRanges()
regime = TranslationRegime(PSTATE.EL);
return HasUnprivileged(regime) && AArch64.IsStage1VMSA(regime);
aarch64/functions/pac/strip/Strip
// Strip()
// =======
// Strip() returns a 64-bit value containing A, but replacing the pointer authentication
// code field bits with the extension of the address bits. This can apply to either
// instructions or data, where, as the use of tagged pointers is distinct, it might be
// handled differently.
if tbi then
original_ptr = A<63:56>:extfield<(56-bottom_PAC_bit)-1:0>:A<bottom_PAC_bit-1:0>;
else
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-349
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
original_ptr = extfield<(64-bottom_PAC_bit)-1:0>:A<bottom_PAC_bit-1:0>;
return original_ptr;
aarch64/functions/pac/trappacuse/TrapPACUse
// TrapPACUse()
// ============
// Used for the trapping of the pointer authentication functions by higher exception
// levels.
TrapPACUse(bits(2) target_el)
assert HaveEL(target_el) && target_el != EL0 && UInt(target_el) >= UInt(PSTATE.EL);
aarch64/functions/ras/AArch64.ESBOperation
// AArch64.ESBOperation()
// ======================
// Perform the AArch64 ESB operation, either for ESB executed in AArch64 state, or for
// ESB in AArch32 state when SError interrupts are routed to an Exception level using
// AArch64
AArch64.ESBOperation()
boolean mask_active;
route_to_el3 = FALSE;
route_to_el2 = (EL2Enabled() &&
(HCR_EL2.TGE == '1' || HCR_EL2.AMO == '1'));
target = if route_to_el3 then EL3 elsif route_to_el2 then EL2 else EL1;
return;
I1-350 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/ras/AArch64.PhysicalSErrorSyndrome
// Return the SError syndrome
bits(25) AArch64.PhysicalSErrorSyndrome(boolean implicit_esb);
aarch64/functions/ras/AArch64.ReportDeferredSError
// AArch64.ReportDeferredSError()
// ==============================
// Generate deferred SError syndrome
aarch64/functions/ras/AArch64.vESBOperation
// AArch64.vESBOperation()
// =======================
// Perform the AArch64 ESB operation for virtual SError interrupts, either for ESB
// executed in AArch64 state, or for ESB in AArch32 state with EL2 using AArch64 state
AArch64.vESBOperation()
assert PSTATE.EL IN {EL0, EL1} && EL2Enabled();
// If physical SError interrupts are routed to EL2, and TGE is not set, then a virtual
// SError interrupt might be pending
vSEI_enabled = HCR_EL2.TGE == '0' && HCR_EL2.AMO == '1';
vSEI_pending = vSEI_enabled && HCR_EL2.VSE == '1';
vintdis = Halted() || ExternalDebugInterruptsDisabled(EL1);
vmasked = vintdis || PSTATE.A == '1';
return;
aarch64/functions/registers/AArch64.MaybeZeroRegisterUppers
// AArch64.MaybeZeroRegisterUppers()
// =================================
// On taking an exception to AArch64 from AArch32, it is CONSTRAINED UNPREDICTABLE whether the top
// 32 bits of registers visible at any lower Exception level using AArch32 are set to zero.
AArch64.MaybeZeroRegisterUppers()
assert UsingAArch32(); // Always called from AArch32 state before entering AArch64 state
integer first;
integer last;
boolean include_R15;
if PSTATE.EL == EL0 && !ELUsingAArch32(EL1) then
first = 0; last = 14; include_R15 = FALSE;
elsif PSTATE.EL IN {EL0, EL1} && EL2Enabled() && !ELUsingAArch32(EL2) then
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-351
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return;
aarch64/functions/registers/AArch64.ResetGeneralRegisters
// AArch64.ResetGeneralRegisters()
// ===============================
AArch64.ResetGeneralRegisters()
for i = 0 to 30
X[i] = bits(64) UNKNOWN;
return;
aarch64/functions/registers/AArch64.ResetSIMDFPRegisters
// AArch64.ResetSIMDFPRegisters()
// ==============================
AArch64.ResetSIMDFPRegisters()
for i = 0 to 31
V[i] = bits(128) UNKNOWN;
return;
aarch64/functions/registers/AArch64.ResetSpecialRegisters
// AArch64.ResetSpecialRegisters()
// ===============================
AArch64.ResetSpecialRegisters()
// AArch32 special registers that are not architecturally mapped to AArch64 registers
if HaveAArch32EL(EL1) then
SPSR_fiq<31:0> = bits(32) UNKNOWN;
SPSR_irq<31:0> = bits(32) UNKNOWN;
SPSR_abt<31:0> = bits(32) UNKNOWN;
SPSR_und<31:0> = bits(32) UNKNOWN;
I1-352 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return;
aarch64/functions/registers/AArch64.ResetSystemRegisters
AArch64.ResetSystemRegisters(boolean cold_reset);
aarch64/functions/registers/PC
// PC - non-assignment form
// ========================
// Read program counter.
bits(64) PC[]
return _PC;
aarch64/functions/registers/SP
// SP[] - assignment form
// ======================
// Write to stack pointer from either a 32-bit or a 64-bit value.
bits(width) SP[]
assert width IN {8,16,32,64};
if PSTATE.SP == '0' then
return SP_EL0<width-1:0>;
else
case PSTATE.EL of
when EL0 return SP_EL0<width-1:0>;
when EL1 return SP_EL1<width-1:0>;
when EL2 return SP_EL2<width-1:0>;
aarch64/functions/registers/V
// V[] - assignment form
// =====================
// Write to SIMD&FP register with implicit extension from
// 8, 16, 32, 64 or 128 bits.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-353
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
bits(width) V[integer n]
assert n >= 0 && n <= 31;
assert width IN {8,16,32,64,128};
return _V[n]<width-1:0>;
aarch64/functions/registers/Vpart
// Vpart[] - non-assignment form
// =============================
// Reads a 128-bit SIMD&FP register in up to two parts:
// part 0 returns the bottom 8, 16, 32 or 64 bits of a value held in the register;
// part 1 returns the top half of the bottom 64 bits or the top half of the 128-bit
// value held in the register.
aarch64/functions/registers/X
// X[] - assignment form
// =====================
// Write to general-purpose register from either a 32-bit or a 64-bit value.
I1-354 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
bits(width) X[integer n]
assert n >= 0 && n <= 31;
assert width IN {8,16,32,64};
if n != 31 then
return _R[n]<width-1:0>;
else
return Zeros(width);
aarch64/functions/sysregisters/CNTKCTL
// CNTKCTL[] - non-assignment form
// ===============================
CNTKCTLType CNTKCTL[]
bits(64) r;
r = CNTKCTL_EL1;
return r;
aarch64/functions/sysregisters/CNTKCTLType
type CNTKCTLType;
aarch64/functions/sysregisters/CPACR
// CPACR[] - non-assignment form
// =============================
CPACRType CPACR[]
bits(64) r;
r = CPACR_EL1;
return r;
aarch64/functions/sysregisters/CPACRType
type CPACRType;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-355
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/sysregisters/ELR
// ELR[] - non-assignment form
// ===========================
bits(64) ELR[]
assert PSTATE.EL != EL0;
return ELR[PSTATE.EL];
aarch64/functions/sysregisters/ESR
// ESR[] - non-assignment form
// ===========================
ESRType ESR[]
return ESR[S1TranslationRegime()];
I1-356 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
otherwise Unreachable();
return;
aarch64/functions/sysregisters/ESRType
type ESRType;
aarch64/functions/sysregisters/FAR
// FAR[] - non-assignment form
// ===========================
bits(64) FAR[]
return FAR[S1TranslationRegime()];
aarch64/functions/sysregisters/MAIR
// MAIR[] - non-assignment form
// ============================
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-357
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
MAIRType MAIR[]
return MAIR[S1TranslationRegime()];
aarch64/functions/sysregisters/MAIRType
type MAIRType;
aarch64/functions/sysregisters/MPUIR
// MPUIR[] - non-assignment form
// =============================
aarch64/functions/sysregisters/MPUIRType
type MPUIRType;
aarch64/functions/sysregisters/PRBARn
// PRBARn[] - non-assignment form
// ==============================
aarch64/functions/sysregisters/PRBARnType
type PRBARnType;
aarch64/functions/sysregisters/PRLARn
// PRLARn[] - non-assignment form
// ==============================
I1-358 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/sysregisters/PRLARnType
type PRLARnType;
aarch64/functions/sysregisters/SCTLR
// SCTLR[] - non-assignment form
// =============================
SCTLRType SCTLR[]
return SCTLR[S1TranslationRegime()];
aarch64/functions/sysregisters/SCTLRType
type SCTLRType;
aarch64/functions/sysregisters/VBAR
// VBAR[] - non-assignment form
// ============================
bits(64) VBAR[]
return VBAR[S1TranslationRegime()];
aarch64/functions/system/AArch64.ImpDefSysInstr
// Execute an implementation-defined system instruction with write (source operand).
AArch64.ImpDefSysInstr(integer el, bits(3) op1, bits(4) CRn, bits(4) CRm, bits(3) op2, integer t);
aarch64/functions/system/AArch64.ImpDefSysInstrWithResult
// Execute an implementation-defined system instruction with read (result operand).
AArch64.ImpDefSysInstrWithResult(integer el, bits(3) op1, bits(4) CRn, bits(4) CRm, bits(3) op2);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-359
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/functions/system/AArch64.ImpDefSysRegRead
// Read from an implementation-defined system register and write the contents of the register to X[t].
AArch64.ImpDefSysRegRead(bits(2) op0, bits(3) op1, bits(4) CRn, bits(4) CRm, bits(3) op2, integer t);
aarch64/functions/system/AArch64.ImpDefSysRegWrite
// Write to an implementation-defined system register.
AArch64.ImpDefSysRegWrite(bits(2) op0, bits(3) op1, bits(4) CRn, bits(4) CRm, bits(3) op2, integer t);
aarch64/functions/system/AArch64.SysInstr
// Execute a system instruction with write (source operand).
AArch64.SysInstr(integer op0, integer op1, integer crn, integer crm, integer op2, integer t);
aarch64/functions/system/AArch64.SysInstrWithResult
// Execute a system instruction with read (result operand).
// Writes the result of the instruction to X[t].
AArch64.SysInstrWithResult(integer op0, integer op1, integer crn, integer crm, integer op2, integer t);
aarch64/functions/system/AArch64.SysRegRead
// Read from a system register and write the contents of the register to X[t].
AArch64.SysRegRead(integer op0, integer op1, integer crn, integer crm, integer op2, integer t);
aarch64/functions/system/AArch64.SysRegWrite
// Write to a system register.
AArch64.SysRegWrite(integer op0, integer op1, integer crn, integer crm, integer op2, integer t);
I1.1.4 aarch64/instrs
This section includes the following pseudocode functions:
• aarch64/instrs/branch/eret/AArch64.ExceptionReturn on page I1-362.
• aarch64/instrs/countop/CountOp on page I1-362.
• aarch64/instrs/extendreg/DecodeRegExtend on page I1-362.
• aarch64/instrs/extendreg/ExtendReg on page I1-363.
• aarch64/instrs/extendreg/ExtendType on page I1-363.
• aarch64/instrs/float/arithmetic/max-min/fpmaxminop/FPMaxMinOp on page I1-363.
• aarch64/instrs/float/arithmetic/unary/fpunaryop/FPUnaryOp on page I1-363.
• aarch64/instrs/float/convert/fpconvop/FPConvOp on page I1-364.
• aarch64/instrs/integer/bitfield/bfxpreferred/BFXPreferred on page I1-364.
• aarch64/instrs/integer/bitmasks/DecodeBitMasks on page I1-364.
• aarch64/instrs/integer/ins-ext/insert/movewide/movewideop/MoveWideOp on page I1-366.
• aarch64/instrs/integer/logical/movwpreferred/MoveWidePreferred on page I1-366.
• aarch64/instrs/integer/shiftreg/DecodeShift on page I1-366.
• aarch64/instrs/integer/shiftreg/ShiftReg on page I1-366.
• aarch64/instrs/integer/shiftreg/ShiftType on page I1-367.
• aarch64/instrs/logicalop/LogicalOp on page I1-367.
• aarch64/instrs/memory/memop/MemAtomicOp on page I1-367.
I1-360 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-361
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/branch/eret/AArch64.ExceptionReturn
// AArch64.ExceptionReturn()
// =========================
// Attempts to change to an illegal state will invoke the Illegal Execution state mechanism
bits(2) source_el = PSTATE.EL;
boolean illegal_psr_state = IllegalExceptionReturn(spsr);
SetPSTATEFromPSR(spsr, illegal_psr_state);
ClearExclusiveLocal(ProcessorID());
SendEventLocal();
if UsingAArch32() then
// 32 most significant bits are ignored.
boolean branch_conditional = FALSE;
BranchTo(new_pc<31:0>, BranchType_ERET, branch_conditional);
else
BranchToAddr(new_pc, BranchType_ERET);
aarch64/instrs/countop/CountOp
enumeration CountOp {CountOp_CLZ, CountOp_CLS, CountOp_CNT};
aarch64/instrs/extendreg/DecodeRegExtend
// DecodeRegExtend()
// =================
// Decode a register extension option
I1-362 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/extendreg/ExtendReg
// ExtendReg()
// ===========
// Perform a register extension and shift
case exttype of
when ExtendType_SXTB unsigned = FALSE; len = 8;
when ExtendType_SXTH unsigned = FALSE; len = 16;
when ExtendType_SXTW unsigned = FALSE; len = 32;
when ExtendType_SXTX unsigned = FALSE; len = 64;
when ExtendType_UXTB unsigned = TRUE; len = 8;
when ExtendType_UXTH unsigned = TRUE; len = 16;
when ExtendType_UXTW unsigned = TRUE; len = 32;
when ExtendType_UXTX unsigned = TRUE; len = 64;
aarch64/instrs/extendreg/ExtendType
enumeration ExtendType {ExtendType_SXTB, ExtendType_SXTH, ExtendType_SXTW, ExtendType_SXTX,
ExtendType_UXTB, ExtendType_UXTH, ExtendType_UXTW, ExtendType_UXTX};
aarch64/instrs/float/arithmetic/max-min/fpmaxminop/FPMaxMinOp
enumeration FPMaxMinOp {FPMaxMinOp_MAX, FPMaxMinOp_MIN,
FPMaxMinOp_MAXNUM, FPMaxMinOp_MINNUM};
aarch64/instrs/float/arithmetic/unary/fpunaryop/FPUnaryOp
enumeration FPUnaryOp {FPUnaryOp_ABS, FPUnaryOp_MOV,
FPUnaryOp_NEG, FPUnaryOp_SQRT};
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-363
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/float/convert/fpconvop/FPConvOp
enumeration FPConvOp {FPConvOp_CVT_FtoI, FPConvOp_CVT_ItoF,
FPConvOp_MOV_FtoI, FPConvOp_MOV_ItoF
, FPConvOp_CVT_FtoI_JS
};
aarch64/instrs/integer/bitfield/bfxpreferred/BFXPreferred
// BFXPreferred()
// ==============
//
// Return TRUE if UBFX or SBFX is the preferred disassembly of a
// UBFM or SBFM bitfield instruction. Must exclude more specific
// aliases UBFIZ, SBFIZ, UXT[BH], SXT[BHW], LSL, LSR and ASR.
aarch64/instrs/integer/bitmasks/DecodeBitMasks
// DecodeBitMasks()
// ================
// Decode AArch64 bitfield and logical immediate masks which use a similar encoding structure
(bits(M), bits(M)) DecodeBitMasks(bit immN, bits(6) imms, bits(6) immr, boolean immediate)
bits(64) tmask, wmask;
bits(6) tmask_and, wmask_and;
bits(6) tmask_or, wmask_or;
bits(6) levels;
I1-364 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
tmask = Ones(64);
tmask = ((tmask
AND Replicate(Replicate(tmask_and<0>, 1) : Ones(1), 32))
OR Replicate(Zeros(1) : Replicate(tmask_or<0>, 1), 32));
// optimization of first step:
// tmask = Replicate(tmask_and<0> : '1', 32);
tmask = ((tmask
AND Replicate(Replicate(tmask_and<1>, 2) : Ones(2), 16))
OR Replicate(Zeros(2) : Replicate(tmask_or<1>, 2), 16));
tmask = ((tmask
AND Replicate(Replicate(tmask_and<2>, 4) : Ones(4), 8))
OR Replicate(Zeros(4) : Replicate(tmask_or<2>, 4), 8));
tmask = ((tmask
AND Replicate(Replicate(tmask_and<3>, 8) : Ones(8), 4))
OR Replicate(Zeros(8) : Replicate(tmask_or<3>, 8), 4));
tmask = ((tmask
AND Replicate(Replicate(tmask_and<4>, 16) : Ones(16), 2))
OR Replicate(Zeros(16) : Replicate(tmask_or<4>, 16), 2));
tmask = ((tmask
AND Replicate(Replicate(tmask_and<5>, 32) : Ones(32), 1))
OR Replicate(Zeros(32) : Replicate(tmask_or<5>, 32), 1));
wmask = Zeros(64);
wmask = ((wmask
AND Replicate(Ones(1) : Replicate(wmask_and<0>, 1), 32))
OR Replicate(Replicate(wmask_or<0>, 1) : Zeros(1), 32));
// optimization of first step:
// wmask = Replicate(wmask_or<0> : '0', 32);
wmask = ((wmask
AND Replicate(Ones(2) : Replicate(wmask_and<1>, 2), 16))
OR Replicate(Replicate(wmask_or<1>, 2) : Zeros(2), 16));
wmask = ((wmask
AND Replicate(Ones(4) : Replicate(wmask_and<2>, 4), 8))
OR Replicate(Replicate(wmask_or<2>, 4) : Zeros(4), 8));
wmask = ((wmask
AND Replicate(Ones(8) : Replicate(wmask_and<3>, 8), 4))
OR Replicate(Replicate(wmask_or<3>, 8) : Zeros(8), 4));
wmask = ((wmask
AND Replicate(Ones(16) : Replicate(wmask_and<4>, 16), 2))
OR Replicate(Replicate(wmask_or<4>, 16) : Zeros(16), 2));
wmask = ((wmask
AND Replicate(Ones(32) : Replicate(wmask_and<5>, 32), 1))
OR Replicate(Replicate(wmask_or<5>, 32) : Zeros(32), 1));
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-365
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/integer/ins-ext/insert/movewide/movewideop/MoveWideOp
enumeration MoveWideOp {MoveWideOp_N, MoveWideOp_Z, MoveWideOp_K};
aarch64/instrs/integer/logical/movwpreferred/MoveWidePreferred
// MoveWidePreferred()
// ===================
//
// Return TRUE if a bitmask immediate encoding would generate an immediate
// value that could also be represented by a single MOVZ or MOVN instruction.
// Used as a condition for the preferred MOV<-ORR alias.
return FALSE;
aarch64/instrs/integer/shiftreg/DecodeShift
// DecodeShift()
// =============
// Decode shift encodings
aarch64/instrs/integer/shiftreg/ShiftReg
// ShiftReg()
// ==========
// Perform shift of a register operand
I1-366 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/integer/shiftreg/ShiftType
enumeration ShiftType {ShiftType_LSL, ShiftType_LSR, ShiftType_ASR, ShiftType_ROR};
aarch64/instrs/logicalop/LogicalOp
enumeration LogicalOp {LogicalOp_AND, LogicalOp_EOR, LogicalOp_ORR};
aarch64/instrs/memory/memop/MemAtomicOp
enumeration MemAtomicOp {MemAtomicOp_ADD,
MemAtomicOp_BIC,
MemAtomicOp_EOR,
MemAtomicOp_ORR,
MemAtomicOp_SMAX,
MemAtomicOp_SMIN,
MemAtomicOp_UMAX,
MemAtomicOp_UMIN,
MemAtomicOp_SWP};
aarch64/instrs/memory/memop/MemOp
enumeration MemOp {MemOp_LOAD, MemOp_STORE, MemOp_PREFETCH};
aarch64/instrs/memory/prefetch/Prefetch
// Prefetch()
// ==========
case prfop<4:3> of
when '00' hint = Prefetch_READ; // PLD: prefetch for load
when '01' hint = Prefetch_EXEC; // PLI: preload instructions
when '10' hint = Prefetch_WRITE; // PST: prepare for store
when '11' return; // unallocated hint
target = UInt(prfop<2:1>); // target cache level
stream = (prfop<0> != '0'); // streaming (non-temporal)
Hint_Prefetch(address, hint, target, stream);
return;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-367
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/barriers/barrierop/MemBarrierOp
enumeration MemBarrierOp { MemBarrierOp_DSB // Data Synchronization Barrier
, MemBarrierOp_DMB // Data Memory Barrier
, MemBarrierOp_ISB // Instruction Synchronization Barrier
, MemBarrierOp_SSBB // Speculative Synchronization Barrier to VA
, MemBarrierOp_PSSBB // Speculative Synchronization Barrier to PA
, MemBarrierOp_SB // Speculation Barrier
};
aarch64/instrs/system/hints/syshintop/SystemHintOp
enumeration SystemHintOp {
SystemHintOp_NOP,
SystemHintOp_YIELD,
SystemHintOp_WFE,
SystemHintOp_WFI,
SystemHintOp_SEV,
SystemHintOp_SEVL,
SystemHintOp_DGH,
SystemHintOp_ESB,
SystemHintOp_TSB,
SystemHintOp_CSDB
};
aarch64/instrs/system/register/cpsr/pstatefield/PSTATEField
enumeration PSTATEField {PSTATEField_DAIFSet, PSTATEField_DAIFClr,
PSTATEField_PAN, // Armv8.1
PSTATEField_UAO, // Armv8.2
PSTATEField_DIT, // Armv8.4
PSTATEField_SSBS,
PSTATEField_SP
};
aarch64/instrs/system/sysops/at/AArch64.AT
// AArch64.AT()
// ============
// Perform address translation as per AT instructions.
fault = NoFault();
fault.acctype = acctype;
fault.write = iswrite;
Regime regime;
if stage == TranslationStage_12 then
regime = Regime_EL10;
else
regime = TranslationRegime(el);
AddressDescriptor addrdesc;
ss = SecurityStateAtEL(el);
if (el == EL0 && ELUsingAArch32(EL1)) || (el != EL0 && ELUsingAArch32(el)) then
I1-368 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
AArch64.EncodePAR(regime, addrdesc);
return;
aarch64/instrs/system/sysops/at/AArch64.EncodePAR
// AArch64.EncodePAR()
// ===================
// Encode PAR register with result of translation.
if !IsFault(addrdesc) then
PAR_EL1.F = '0';
PAR_EL1<11> = '1'; // RES1
if SecurityStateForRegime(regime) == SS_Secure then
PAR_EL1.NS = if paspace == PAS_Secure then '0' else '1';
else
PAR_EL1.NS = bit UNKNOWN;
PAR_EL1.SH = ReportedPARShareability(PAREncodeShareability(addrdesc.memattrs));
PAR_EL1.PA = addrdesc.paddress.address<52-1:12>;
PAR_EL1.ATTR = ReportedPARAttrs(EncodePARAttrs(addrdesc.memattrs));
PAR_EL1<10> = bit IMPLEMENTATION_DEFINED "Non-Faulting PAR";
else
PAR_EL1.F = '1';
PAR_EL1.FST = AArch64.PARFaultStatus(addrdesc.fault);
PAR_EL1.PTW = if addrdesc.fault.s2fs1walk then '1' else '0';
PAR_EL1.S = if addrdesc.fault.secondstage then '1' else '0';
PAR_EL1<11> = '1'; // RES1
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-369
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/at/AArch64.PARFaultStatus
// AArch64.PARFaultStatus()
// ========================
// Fault status field decoding of 64-bit PAR.
aarch64/instrs/system/sysops/dc/AArch64.DC
// AArch64.DC()
// ============
// Perform Data Cache Operation.
cache.acctype = acctype;
cache.cachetype = cachetype;
cache.cacheop = cacheop;
cache.opscope = opscope;
CACHE_OP(cache);
return;
if EL2Enabled() then
if PSTATE.EL IN {EL0, EL1} then
cache.is_vmid_valid = TRUE;
cache.vmid = VMID[];
else
cache.is_vmid_valid = FALSE;
else
cache.is_vmid_valid = FALSE;
I1-370 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
if opscope == CacheOpScope_PoDP && boolean IMPLEMENTATION_DEFINED "Memory system does not supports
PoDP" then
opscope = CacheOpScope_PoP;
if opscope == CacheOpScope_PoP && boolean IMPLEMENTATION_DEFINED "Memory system does not supports
PoP" then
opscope = CacheOpScope_PoC;
need_translate = DCInstNeedsTranslation(opscope);
iswrite = cacheop == CacheOp_Invalidate;
vaddress = regval;
cache.translated = need_translate;
cache.vaddress = vaddress;
if need_translate then
wasaligned = TRUE;
memaddrdesc = AArch64.TranslateAddress(vaddress, acctype, iswrite, wasaligned, size);
if IsFault(memaddrdesc) then
AArch64.Abort(regval, memaddrdesc.fault);
memattrs = memaddrdesc.memattrs;
cache.paddress = memaddrdesc.paddress;
cache.cpas = CPASAtPAS(memaddrdesc.paddress.paspace);
if opscope IN {CacheOpScope_PoC, CacheOpScope_PoP, CacheOpScope_PoDP} then
cache.shareability = memattrs.shareability;
else
cache.shareability = Shareability_NSH;
else
cache.shareability = Shareability UNKNOWN;
cache.paddress = FullAddress UNKNOWN;
if cacheop == CacheOp_Invalidate && PSTATE.EL == EL1 && EL2Enabled() && HCR_EL2.<DC,VM> != '00' then
cache.cacheop = CacheOp_CleanInvalidate;
CACHE_OP(cache);
return;
aarch64/instrs/system/sysops/dc/AArch64.MemZero
// AArch64.MemZero()
// =================
if IsFault(memaddrdesc) then
if IsDebugException(memaddrdesc.fault) then
AArch64.Abort(vaddress, memaddrdesc.fault);
else
AArch64.Abort(regval, memaddrdesc.fault);
else
if cachetype == CacheType_Data then
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-371
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/ic/AArch64.IC
// AArch64.IC()
// ============
// Perform Instruction Cache Operation.
AArch64.IC(CacheOpScope opscope)
regval = bits(64) UNKNOWN;
AArch64.IC(regval, opscope);
// AArch64.IC()
// ============
// Perform Instruction Cache Operation.
cache.acctype = acctype;
cache.cachetype = CacheType_Instruction;
cache.cacheop = CacheOp_Invalidate;
cache.opscope = opscope;
if EL2Enabled() then
if PSTATE.EL IN {EL0, EL1} then
cache.is_vmid_valid = TRUE;
cache.vmid = VMID[];
else
cache.is_vmid_valid = FALSE;
else
cache.is_vmid_valid = FALSE;
cache.vaddress = regval;
cache.shareability = Shareability_NSH;
cache.translated = need_translate;
if !need_translate then
cache.paddress = FullAddress UNKNOWN;
CACHE_OP(cache);
return;
iswrite = FALSE;
I1-372 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
wasaligned = TRUE;
size = 0;
memaddrdesc = AArch64.TranslateAddress(vaddress, acctype, iswrite, wasaligned, size);
if IsFault(memaddrdesc) then
AArch64.Abort(regval, memaddrdesc.fault);
cache.cpas = CPASAtPAS(memaddrdesc.paddress.paspace);
cache.paddress = memaddrdesc.paddress;
CACHE_OP(cache);
return;
aarch64/instrs/system/sysops/predictionrestrict/RestrictPrediction
// RestrictPrediction()
// ====================
// Clear all predictions in the context.
ExecutionCntxt c;
target_el = val<25:24>;
bit ns = val<26>;
ss = TargetSecurityState(ns);
c.security = ss;
c.target_el = target_el;
if EL2Enabled() then
if PSTATE.EL IN {EL0, EL1} then
c.is_vmid_valid = TRUE;
c.all_vmid = FALSE;
c.vmid = VMID[];
else
c.is_asid_valid = FALSE;
c.restriction = restriction;
RESTRICT_PREDICTIONS(c);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-373
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/sysop/SysOp
// SysOp()
// =======
I1-374 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/sysop/SystemOp
enumeration SystemOp {Sys_AT, Sys_DC, Sys_IC, Sys_TLBI, Sys_SYS};
aarch64/instrs/system/sysops/tlbi/AArch32.DTLBI_ALL
// AArch32.DTLBI_ALL()
// ===================
// Invalidate all data TLB entries for the indicated translation regime with the
// the indicated security state for all TLBs within the indicated shareability domain.
// Invalidation applies to all applicable stage 1 and stage 2 entries.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
TLBIRecord r;
r.op = TLBIOp_DALL;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.level = TLBILevel_Any;
r.attr = attr;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch32.DTLBI_ASID
// AArch32.DTLBI_ASID()
// ====================
// Invalidate all data TLB stage 1 entries matching the indicated VMID (where regime supports)
// and ASID in the parameter Rt in the indicated translation regime with the
// indicated security state for all TLBs within the indicated shareability domain.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_DASID;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = TLBILevel_Any;
r.attr = attr;
r.asid = Zeros(8) : Rt<7:0>;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-375
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/tlbi/AArch32.DTLBI_VA
// AArch32.DTLBI_VA()
// ==================
// Invalidate by VA all stage 1 data TLB entries in the indicated shareability domain
// matching the indicated VMID and ASID (where regime supports VMID, ASID) in the indicated regime
// with the indicated security state.
// ASID, VA and related parameters are derived from Rt.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_DVA;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
r.asid = Zeros(8) : Rt<7:0>;
r.address = Zeros(32) : Rt<31:12> : Zeros(12);
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch32.ITLBI_ALL
// AArch32.ITLBI_ALL()
// ===================
// Invalidate all instruction TLB entries for the indicated translation regime with the
// the indicated security state for all TLBs within the indicated shareability domain.
// Invalidation applies to all applicable stage 1 and stage 2 entries.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
TLBIRecord r;
r.op = TLBIOp_IALL;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.level = TLBILevel_Any;
r.attr = attr;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
I1-376 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/tlbi/AArch32.ITLBI_ASID
// AArch32.ITLBI_ASID()
// ====================
// Invalidate all instruction TLB stage 1 entries matching the indicated VMID (where regime supports)
// and ASID in the parameter Rt in the indicated translation regime with the
// indicated security state for all TLBs within the indicated shareability domain.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_IASID;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = TLBILevel_Any;
r.attr = attr;
r.asid = Zeros(8) : Rt<7:0>;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch32.ITLBI_VA
// AArch32.ITLBI_VA()
// ==================
// Invalidate by VA all stage 1 instruction TLB entries in the indicated shareability domain
// matching the indicated VMID and ASID (where regime supports VMID, ASID) in the indicated regime
// with the indicated security state.
// ASID, VA and related parameters are derived from Rt.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_IVA;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
r.asid = Zeros(8) : Rt<7:0>;
r.address = Zeros(32) : Rt<31:12> : Zeros(12);
TLBI(r);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-377
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/tlbi/AArch32.TLBI_ALL
// AArch32.TLBI_ALL()
// ==================
// Invalidate all entries for the indicated translation regime with the
// the indicated security state for all TLBs within the indicated shareability domain.
// Invalidation applies to all applicable stage 1 and stage 2 entries.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_ALL;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.level = TLBILevel_Any;
r.attr = attr;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch32.TLBI_ASID
// AArch32.TLBI_ASID()
// ===================
// Invalidate all stage 1 entries matching the indicated VMID (where regime supports)
// and ASID in the parameter Rt in the indicated translation regime with the
// indicated security state for all TLBs within the indicated shareability domain.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_ASID;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = TLBILevel_Any;
r.attr = attr;
r.asid = Zeros(8) : Rt<7:0>;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
I1-378 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/tlbi/AArch32.TLBI_IPAS2
// AArch32.TLBI_IPAS2()
// ====================
// Invalidate by IPA all stage 2 only TLB entries in the indicated shareability
// domain matching the indicated VMID in the indicated regime with the indicated security state.
// Note: stage 1 and stage 2 combined entries are not in the scope of this operation.
// IPA and related parameters of the are derived from Rt.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_IPAS2;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
r.address = Zeros(24) : Rt<27:0> : Zeros(12);
r.ipaspace = PAS_NonSecure;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch32.TLBI_VA
// AArch32.TLBI_VA()
// =================
// Invalidate by VA all stage 1 TLB entries in the indicated shareability domain
// matching the indicated VMID and ASID (where regime supports VMID, ASID) in the indicated regime
// with the indicated security state.
// ASID, VA and related parameters are derived from Rt.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_VA;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
r.asid = Zeros(8) : Rt<7:0>;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-379
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch32.TLBI_VAA
// AArch32.TLBI_VAA()
// ==================
// Invalidate by VA all stage 1 TLB entries in the indicated shareability domain
// matching the indicated VMID (where regime supports VMID) and all ASID in the indicated regime
// with the indicated security state.
// VA and related parameters are derived from Rt.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_VAA;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
r.address = Zeros(32) : Rt<31:12> : Zeros(12);
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch32.TLBI_VMALL
// AArch32.TLBI_VMALL()
// ====================
// Invalidate all stage 1 entries for the indicated translation regime with the
// the indicated security state for all TLBs within the indicated shareability
// domain that match the indicated VMID (where applicable).
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// Note: stage 2 only entries are not in the scope of this operation.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_VMALL;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
I1-380 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
r.level = TLBILevel_Any;
r.vmid = vmid;
r.attr = attr;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch32.TLBI_VMALLS12
// AArch32.TLBI_VMALLS12()
// =======================
// Invalidate all stage 1 and stage 2 entries for the indicated translation
// regime with the indicated security state for all TLBs within the indicated
// shareability domain that match the indicated VMID.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_VMALLS12;
r.from_aarch64 = FALSE;
r.security = security;
r.regime = regime;
r.level = TLBILevel_Any;
r.vmid = vmid;
r.attr = attr;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_ALL
// AArch64.TLBI_ALL()
// ==================
// Invalidate all entries for the indicated translation regime with the
// the indicated security state for all TLBs within the indicated shareability domain.
// Invalidation applies to all applicable stage 1 and stage 2 entries.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_ALL;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.level = TLBILevel_Any;
r.attr = attr;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-381
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_ASID
// AArch64.TLBI_ASID()
// ===================
// Invalidate all stage 1 entries matching the indicated VMID (where regime supports)
// and ASID in the parameter Xt in the indicated translation regime with the
// indicated security state for all TLBs within the indicated shareability domain.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_ASID;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = TLBILevel_Any;
r.attr = attr;
r.asid = Xt<63:48>;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_IPAS2
// AArch64.TLBI_IPAS2()
// ====================
// Invalidate by IPA all stage 2 only TLB entries in the indicated shareability
// domain matching the indicated VMID in the indicated regime with the indicated security state.
// Note: stage 1 and stage 2 combined entries are not in the scope of this operation.
// IPA and related parameters of the are derived from Xt.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_IPAS2;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
r.address = ZeroExtend(Xt<39:0> : Zeros(12));
case security of
when SS_NonSecure
r.ipaspace = PAS_NonSecure;
when SS_Secure
r.ipaspace = if Xt<63> == '1' then PAS_NonSecure else PAS_Secure;
I1-382 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_RIPAS2
// AArch64.TLBI_RIPAS2()
// =====================
// Range invalidate by IPA all stage 2 only TLB entries in the indicated
// shareability domain matching the indicated VMID in the indicated regime with the indicated
// security state.
// Note: stage 1 and stage 2 combined entries are not in the scope of this operation.
// The range of IPA and related parameters of the are derived from Xt.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_RIPAS2;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
bits(2) tg = Xt<47:46>;
integer scale = UInt(Xt<45:44>);
integer num = UInt(Xt<43:39>);
integer baseaddr = SInt(Xt<36:0>);
boolean valid;
case security of
when SS_NonSecure
r.ipaspace = PAS_NonSecure;
when SS_Secure
r.ipaspace = if Xt<63> == '1' then PAS_NonSecure else PAS_Secure;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_RVA
// AArch64.TLBI_RVA()
// ==================
// Range invalidate by VA range all stage 1 TLB entries in the indicated
// shareability domain matching the indicated VMID and ASID (where regime
// supports VMID, ASID) in the indicated regime with the indicated security state.
// ASID, and range related parameters are derived from Xt.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-383
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_RVA;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
r.asid = Xt<63:48>;
boolean valid;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_RVAA
// AArch64.TLBI_RVAA()
// ===================
// Range invalidate by VA range all stage 1 TLB entries in the indicated
// shareability domain matching the indicated VMID (where regimesupports VMID)
// and all ASID in the indicated regime with the indicated security state.
// VA range related parameters are derived from Xt.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_RVAA;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
bits(2) tg = Xt<47:46>;
integer scale = UInt(Xt<45:44>);
integer num = UInt(Xt<43:39>);
I1-384 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
boolean valid;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_VA
// AArch64.TLBI_VA()
// =================
// Invalidate by VA all stage 1 TLB entries in the indicated shareability domain
// matching the indicated VMID and ASID (where regime supports VMID, ASID) in the indicated regime
// with the indicated security state.
// ASID, VA and related parameters are derived from Xt.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_VA;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
r.asid = Xt<63:48>;
r.address = ZeroExtend(Xt<43:0> : Zeros(12));
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_VAA
// AArch64.TLBI_VAA()
// ==================
// Invalidate by VA all stage 1 TLB entries in the indicated shareability domain
// matching the indicated VMID (where regime supports VMID) and all ASID in the indicated regime
// with the indicated security state.
// VA and related parameters are derived from Xt.
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// When the indicated level is
// TLBILevel_Any : this applies to TLB entries at all levels
// TLBILevel_Last : this applies to TLB entries at last level only
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-385
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
TLBIRecord r;
r.op = TLBIOp_VAA;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.vmid = vmid;
r.level = level;
r.attr = attr;
r.address = ZeroExtend(Xt<43:0> : Zeros(12));
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_VMALL
// AArch64.TLBI_VMALL()
// ====================
// Invalidate all stage 1 entries for the indicated translation regime with the
// the indicated security state for all TLBs within the indicated shareability
// domain that match the indicated VMID (where applicable).
// Note: stage 1 and stage 2 combined entries are in the scope of this operation.
// Note: stage 2 only entries are not in the scope of this operation.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
TLBIRecord r;
r.op = TLBIOp_VMALL;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.level = TLBILevel_Any;
r.vmid = vmid;
r.attr = attr;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/AArch64.TLBI_VMALLS12
// AArch64.TLBI_VMALLS12()
// =======================
// Invalidate all stage 1 and stage 2 entries for the indicated translation
// regime with the indicated security state for all TLBs within the indicated
// shareability domain that match the indicated VMID.
// The indicated attr defines the attributes of the memory operations that must be completed in
// order to deem this operation to be completed.
// When attr is TLBI_ExcludeXS, only operations with XS=0 within the scope of this TLB operation
// are required to complete.
I1-386 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
TLBIRecord r;
r.op = TLBIOp_VMALLS12;
r.from_aarch64 = TRUE;
r.security = security;
r.regime = regime;
r.level = TLBILevel_Any;
r.vmid = vmid;
r.attr = attr;
TLBI(r);
if shareability != Shareability_NSH then Broadcast(shareability, r);
return;
aarch64/instrs/system/sysops/tlbi/ASID_NONE
constant bits(16) ASID_NONE = Zeros();
aarch64/instrs/system/sysops/tlbi/Broadcast
// Broadcast()
// ===========
// IMPLEMENTATION DEFINED function to broadcast TLBI operation within the indicated shareability
// domain.
aarch64/instrs/system/sysops/tlbi/DecodeTLBITG
// DecodeTLBITG()
// ==============
// Decode translation granule size in TLBI range instructions
aarch64/instrs/system/sysops/tlbi/HasLargeAddress
// HasLargeAddress()
// =================
// Returns TRUE if the regime is configured for 52 bit addresses, FALSE otherwise.
aarch64/instrs/system/sysops/tlbi/TLBI
// TLBI()
// ======
// Performs TLB maintenance of operation on TLB to invalidate the matching transition table entries.
TLBI(TLBIRecord r)
IMPLEMENTATION_DEFINED;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-387
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/instrs/system/sysops/tlbi/TLBILevel
enumeration TLBILevel {
TLBILevel_Any,
TLBILevel_Last
};
aarch64/instrs/system/sysops/tlbi/TLBIMatch
// TLBIMatch()
// ===========
// Determine whether the TLB entry lies within the scope of inavlidation
I1-388 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return match;
aarch64/instrs/system/sysops/tlbi/TLBIMemAttr
enumeration TLBIMemAttr {
TLBI_AllAttr,
TLBI_ExcludeXS
};
aarch64/instrs/system/sysops/tlbi/TLBIOp
enumeration TLBIOp {
TLBIOp_DALL, // AArch32 Data TLBI operations - deprecated
TLBIOp_DASID,
TLBIOp_DVA,
TLBIOp_IALL, // AArch32 Instruction TLBI operations - deprecated
TLBIOp_IASID,
TLBIOp_IVA,
TLBIOp_ALL,
TLBIOp_ASID,
TLBIOp_IPAS2,
TLBIOp_VAA,
TLBIOp_VA,
TLBIOp_VMALL,
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-389
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
TLBIOp_VMALLS12,
TLBIOp_RIPAS2,
TLBIOp_RVAA,
TLBIOp_RVA,
};
aarch64/instrs/system/sysops/tlbi/TLBIRange
// TLBIRange()
// ===========
// Extract the input address range information from encoded Xt.
bits(2) tg = Xt<47:46>;
integer scale = UInt(Xt<45:44>);
integer num = UInt(Xt<43:39>);
integer tg_bits;
if tg == '00' then
return (FALSE, tg, start, end);
case tg of
when '01' // 4KB
tg_bits = 12;
if HasLargeAddress(regime) then
start<52:16> = Xt<36:0>;
start<63:53> = Replicate(Xt<36>, 11);
else
start<48:12> = Xt<36:0>;
start<63:49> = Replicate(Xt<36>, 15);
when '10' // 16KB
tg_bits = 14;
if HasLargeAddress(regime) then
start<52:16> = Xt<36:0>;
start<63:53> = Replicate(Xt<36>, 11);
else
start<50:14> = Xt<36:0>;
start<63:51> = Replicate(Xt<36>, 13);
when '11' // 64KB
tg_bits = 16;
start<52:16> = Xt<36:0>;
start<63:53> = Replicate(Xt<36>, 11);
otherwise
Unreachable();
aarch64/instrs/system/sysops/tlbi/TLBIRecord
type TLBIRecord is (
TLBIOp op,
boolean from_aarch64, // originated as an AArch64 operation
SecurityState security,
I1-390 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
Regime regime,
bits(16) vmid,
bits(16) asid,
TLBILevel level,
TLBIMemAttr attr,
PASpace ipaspace, // For operations that take IPA as input address
bits(64) address, // input address, for range operations, start address
bits(64) end_address, // for range operations, end address
bits(2) tg, // for range operations, translation granule
)
aarch64/instrs/system/sysops/tlbi/VMID
// VMID[]
// ======
// Effective VMID.
bits(16) VMID[]
return VSCTLR_EL2.VMID;
aarch64/instrs/system/sysops/tlbi/VMID_NONE
constant bits(16) VMID_NONE = Zeros();
aarch64/instrs/vector/arithmetic/binary/uniform/logical/bsl-eor/vbitop/VBitOp
enumeration VBitOp {VBitOp_VBIF, VBitOp_VBIT, VBitOp_VBSL, VBitOp_VEOR};
aarch64/instrs/vector/arithmetic/unary/cmp/compareop/CompareOp
enumeration CompareOp {CompareOp_GT, CompareOp_GE, CompareOp_EQ,
CompareOp_LE, CompareOp_LT};
aarch64/instrs/vector/logical/immediateop/ImmediateOp
enumeration ImmediateOp {ImmediateOp_MOVI, ImmediateOp_MVNI,
ImmediateOp_ORR, ImmediateOp_BIC};
aarch64/instrs/vector/reduce/reduceop/Reduce
// Reduce()
// ========
// Perform the operation 'op' on pairs of elements from the input vector,
// reducing the vector to a scalar result.
if N == esize then
return input<esize-1:0>;
half = N DIV 2;
hi = Reduce(op, input<N-1:half>, esize);
lo = Reduce(op, input<half-1:0>, esize);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-391
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
case op of
when ReduceOp_FMINNUM
result = FPMinNum(lo, hi, FPCR[]);
when ReduceOp_FMAXNUM
result = FPMaxNum(lo, hi, FPCR[]);
when ReduceOp_FMIN
result = FPMin(lo, hi, FPCR[]);
when ReduceOp_FMAX
result = FPMax(lo, hi, FPCR[]);
when ReduceOp_FADD
result = FPAdd(lo, hi, FPCR[]);
when ReduceOp_ADD
result = lo + hi;
return result;
aarch64/instrs/vector/reduce/reduceop/ReduceOp
enumeration ReduceOp {ReduceOp_FMINNUM, ReduceOp_FMAXNUM,
ReduceOp_FMIN, ReduceOp_FMAX,
ReduceOp_FADD, ReduceOp_ADD};
I1.1.5 aarch64/translation
This section includes the following pseudocode functions:
• aarch64/translation/debug/AArch64.CheckBreakpoint on page I1-393.
• aarch64/translation/debug/AArch64.CheckDebug on page I1-394.
• aarch64/translation/debug/AArch64.CheckWatchpoint on page I1-394.
• aarch64/translation/pmsa_validation/AArch64.DetermineS2PASpace on page I1-395.
• aarch64/translation/pmsa_validation/AArch64.FullValidate on page I1-395.
• aarch64/translation/pmsa_validation/AArch64.IsStage1VMSA on page I1-396.
• aarch64/translation/pmsa_validation/AArch64.MPUValidate on page I1-396.
• aarch64/translation/pmsa_validation/AArch64.S1Validate on page I1-397.
• aarch64/translation/pmsa_validation/AArch64.S2Validate on page I1-399.
• aarch64/translation/vmsa_addrcalc/AArch64.BlockBase on page I1-401.
• aarch64/translation/vmsa_addrcalc/AArch64.IASize on page I1-401.
• aarch64/translation/vmsa_addrcalc/AArch64.NextTableBase on page I1-401.
• aarch64/translation/vmsa_addrcalc/AArch64.PageBase on page I1-402.
• aarch64/translation/vmsa_addrcalc/AArch64.PhysicalAddressSize on page I1-402.
• aarch64/translation/vmsa_addrcalc/AArch64.S1StartLevel on page I1-402.
• aarch64/translation/vmsa_addrcalc/AArch64.TTBaseAddress on page I1-403.
• aarch64/translation/vmsa_addrcalc/AArch64.TTEntryAddress on page I1-403.
• aarch64/translation/vmsa_faults/AArch64.AddrTop on page I1-404.
• aarch64/translation/vmsa_faults/AArch64.ContiguousBitFaults on page I1-404.
• aarch64/translation/vmsa_faults/AArch64.DebugFault on page I1-404.
• aarch64/translation/vmsa_faults/AArch64.OAOutOfRange on page I1-404.
• aarch64/translation/vmsa_faults/AArch64.S1HasAlignmentFault on page I1-405.
• aarch64/translation/vmsa_faults/AArch64.S1HasPermissionsFault_VMSA on page I1-405.
• aarch64/translation/vmsa_faults/AArch64.S1InvalidTxSZ on page I1-408.
• aarch64/translation/vmsa_faults/AArch64.S2HasAlignmentFault on page I1-408.
• aarch64/translation/vmsa_faults/AArch64.VAIsOutOfRange on page I1-409.
• aarch64/translation/vmsa_memattr/AArch64.S2ApplyFWBMemAttrs on page I1-409.
• aarch64/translation/vmsa_tlbcontext/AArch64.GetS1TLBContext on page I1-410.
I1-392 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/debug/AArch64.CheckBreakpoint
// AArch64.CheckBreakpoint()
// =========================
// Called before executing the instruction of length "size" bytes at "vaddress" in an AArch64
// translation regime, when either debug exceptions are enabled, or halting debug is enabled
// and halting is allowed.
match = FALSE;
for i = 0 to NumBreakpointsImplemented() - 1
match_i = AArch64.BreakpointMatch(i, vaddress, size);
match = match || match_i;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-393
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/debug/AArch64.CheckDebug
// AArch64.CheckDebug()
// ====================
// Called on each access to check for a debug exception or entry to Debug state.
return fault;
aarch64/translation/debug/AArch64.CheckWatchpoint
// AArch64.CheckWatchpoint()
// =========================
// Called before accessing the memory location of "size" bytes at "address",
// when either debug exceptions are enabled for the access, or halting debug
// is enabled and halting is allowed.
match = FALSE;
match_on_read = FALSE;
ispriv = AArch64.AccessUsesEL(acctype) != EL0;
for i = 0 to NumWatchpointsImplemented() - 1
if AArch64.WatchpointMatch(i, vaddress, size, ispriv, acctype, iswrite) then
match = TRUE;
if DBGWCR_EL1[i].LSC<0> == '1' then
match_on_read = TRUE;
I1-394 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
iswrite = !match_on_read;
aarch64/translation/pmsa_validation/AArch64.DetermineS2PASpace
// AArch64.DetermineS2PASpace()
// ============================
// Determine stage 2 Physical Address Space for EL1&0 translation regime.
aarch64/translation/pmsa_validation/AArch64.FullValidate
// AArch64.FullValidate()
// ======================
// Apply VMSA translation / PMSA validation on memory access subject to
// configuration and translation regime
regime = TranslationRegime(PSTATE.EL);
ispriv = PSTATE.EL != EL0 && acctype != AccType_UNPRIV;
if AArch64.IsStage1VMSA(regime) then
// Stage 1 translation follows v8A VMSA
ss = SS_Secure;
(fault, ipa) = AArch64.S1Translate(fault, regime, ss, va, acctype, aligned, iswrite, ispriv);
else
// Stage 1 is validated by V8R PMSA
(fault, ipa) = AArch64.S1Validate(fault, regime, va, acctype, aligned, iswrite, ispriv);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-395
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return pa;
else
return ipa;
aarch64/translation/pmsa_validation/AArch64.IsStage1VMSA
// AArch64.IsStage1VMSA()
// ======================
// Determine whether V8A VMSA is applied to stage 1 translation
aarch64/translation/pmsa_validation/AArch64.MPUValidate
// AArch64.MPUValidate()
// =====================
// Attempt to match the input address with an active Memory Protection Unit (MPU) and
// retrieve assigned permissions and memory attributes
matched = TRUE;
matched_prbar = prbar;
matched_prlar = prlar;
I1-396 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/pmsa_validation/AArch64.S1Validate
// AArch64.S1Validate()
// ====================
// Perform stage 1 PMSA validation using Memory Protection Units (MPUs).
integer addrtop;
// Prepare fault fields if one is detected
fault.secondstage = FALSE;
fault.s2fs1walk = FALSE;
fault.level = 0;
case regime of
when Regime_EL2 addrtop = AArch64.AddrTop(TCR_EL2.TBID, acctype, TCR_EL2.TBI);
when Regime_EL10 addrtop = AArch64.AddrTop(TCR_EL1.TBID0, acctype, TCR_EL1.TBI0);
if !IsZero(va<addrtop:AArch64.PAMax()>) then
fault.statuscode = Fault_Translation;
return (fault, AddressDescriptor UNKNOWN);
Permissions s1_permissions;
PASpace s1_paspace;
bits(8) s1_attr;
bits(2) s1_sh;
boolean valid;
if AArch64.S1Enabled(regime) then
boolean matched;
PRBARnType prbar;
PRLARnType prlar;
(fault, matched, prbar, prlar) = AArch64.MPUValidate(fault, regime, va);
if HasUnprivileged(regime) then
s1_permissions.ap<2:1> = prbar.AP;
s1_permissions.pxn = prbar.XN<1>;
s1_permissions.uxn = prbar.XN<1>;
else
s1_permissions.ap<2:1> = prbar.AP<1>:'1';
s1_permissions.xn = prbar.XN<1>;
MAIRType s1_mair;
case regime of
when Regime_EL2 s1_mair = MAIR_EL2;
when Regime_EL10 s1_mair = MAIR_EL1;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-397
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
if !valid then
fault.statuscode = Fault_Translation;
return (fault, AddressDescriptor UNKNOWN);
else
// No MPU match nor background region enabled
fault.statuscode = Fault_Translation;
return (fault, AddressDescriptor UNKNOWN);
if !valid then
fault.statuscode = Fault_Translation;
return (fault, AddressDescriptor UNKNOWN);
MPURecord mpurecord;
mpurecord.paspace = s1_paspace;
mpurecord.permissions = s1_permissions;
s1aarch64 = TRUE;
mpurecord.memattrs = S1DecodeMemAttrs(s1_attr, s1_sh, s1aarch64);
MemoryAttributes memattrs;
if ((acctype == AccType_IFETCH &&
(mpurecord.memattrs.memtype == MemType_Device || !AArch64.S1ICacheEnabled(regime))) ||
(acctype != AccType_IFETCH &&
mpurecord.memattrs.memtype == MemType_Normal && !AArch64.S1DCacheEnabled(regime))) then
// Treat memory attributes as Normal Non-Cacheable
memattrs = NormalNCMemAttr();
else
memattrs = mpurecord.memattrs;
// Output Address
FullAddress oa;
oa.paspace = mpurecord.paspace;
oa.address = va<51:0>;
I1-398 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/pmsa_validation/AArch64.S2Validate
// AArch64.S2Validate()
// ====================
// Perform stage 2 PMSA validation using Memory Protection Units (MPUs).
// Stage 2 is disabled
if HCR_EL2.DC == '0' && HCR_EL2.VM == '0' then
pa = ipa;
return (fault, pa);
s2_permissions.ap<2:1> = prbar.AP;
s2_permissions.xn = prbar.XN<1>;
if HaveExtendedExecuteNeverExt() then
s2_permissions.s2xnx = prbar.XN<0>;
else
s2_permissions.s2xnx = '0';
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-399
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
if !valid then
fault.statuscode = Fault_Translation;
return (fault, AddressDescriptor UNKNOWN);
else
// When HCR_EL2.VM is effectively '1' and SCTLR_EL2.{M, BR} = {0,0},
// the behavior is CONSTRAINED UNPREDICTABLE.
c = ConstrainUnpredictable();
assert c IN {Constraint_MPU_FAULT, Constraint_MPU_ATTR_UNKNOWN};
if c == Constraint_MPU_FAULT then
fault.statuscode = Fault_Translation;
return (fault, AddressDescriptor UNKNOWN);
else
s2_attr = bits(8) UNKNOWN;
s2_sh = bits(2) UNKNOWN;
s2_permissions = Permissions UNKNOWN;
s2_paspace = ipa.paddress.paspace;
MPURecord mpurecord;
// Stage 2 PA space is determined from stage 2 configuration and stage 1 IPA space
mpurecord.paspace = AArch64.DetermineS2PASpace(ipa.paddress.paspace, s2_paspace);
mpurecord.permissions = s2_permissions;
MemoryAttributes s2_memattrs;
if ((s2fs1walk && mpurecord.memattrs.memtype == MemType_Device && HCR_EL2.PTW == '0') ||
(acctype == AccType_IFETCH &&
(mpurecord.memattrs.memtype == MemType_Device || HCR_EL2.ID == '1')) ||
(acctype != AccType_IFETCH &&
mpurecord.memattrs.memtype == MemType_Normal && HCR_EL2.CD == '1')) then
// Treat memory attributes as Normal Non-Cacheable
s2_memattrs = NormalNCMemAttr();
else
s2_memattrs = mpurecord.memattrs;
MemoryAttributes memattrs;
if !HaveStage2MemAttrControl() || HCR_EL2.FWB == '0' then
I1-400 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
// Output Address
FullAddress oa;
oa.paspace = mpurecord.paspace;
oa.address = ipa.paddress.address;
pa = CreateAddressDescriptor(ipa.vaddress, oa, memattrs);
return (fault, pa);
aarch64/translation/vmsa_addrcalc/AArch64.BlockBase
// AArch64.BlockBase()
// ===================
// Extract the address embedded in a block descriptor pointing to the base of
// a memory block
return blockbase;
aarch64/translation/vmsa_addrcalc/AArch64.IASize
// AArch64.IASize()
// ================
// Retrieve the number of bits containing the input address
aarch64/translation/vmsa_addrcalc/AArch64.NextTableBase
// AArch64.NextTableBase()
// =======================
// Extract the address embedded in a table descriptor pointing to the base of
// the next level table of descriptors
case tgx of
when TGx_4KB tablebase<47:12> = descriptor<47:12>;
when TGx_16KB tablebase<47:14> = descriptor<47:14>;
when TGx_64KB tablebase<47:16> = descriptor<47:16>;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-401
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return tablebase;
aarch64/translation/vmsa_addrcalc/AArch64.PageBase
// AArch64.PageBase()
// ==================
// Extract the address embedded in a page descriptor pointing to the base of
// a memory page
case tgx of
when TGx_4KB pagebase<47:12> = descriptor<47:12>;
when TGx_16KB pagebase<47:14> = descriptor<47:14>;
when TGx_64KB pagebase<47:16> = descriptor<47:16>;
return pagebase;
aarch64/translation/vmsa_addrcalc/AArch64.PhysicalAddressSize
// AArch64.PhysicalAddressSize()
// =============================
// Retrieve the number of bits bounding the physical address
case encoded_ps of
when '000' ps = 32;
when '001' ps = 36;
when '010' ps = 40;
when '011' ps = 42;
when '100' ps = 44;
when '101' ps = 48;
when '110' ps = 52;
otherwise
ps = integer IMPLEMENTATION_DEFINED "Reserved Intermediate Physical Address size value";
aarch64/translation/vmsa_addrcalc/AArch64.S1StartLevel
// AArch64.S1StartLevel()
// ======================
// Compute the initial lookup level when performing a stage 1 translation
// table walk
I1-402 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
granulebits = TGxGranuleBits(walkparams.tgx);
stride = granulebits - 3;
aarch64/translation/vmsa_addrcalc/AArch64.TTBaseAddress
// AArch64.TTBaseAddress()
// =======================
// Retrieve the PA/IPA pointing to the base of the initial translation table
aarch64/translation/vmsa_addrcalc/AArch64.TTEntryAddress
// AArch64.TTEntryAddress()
// ========================
// Compute translation table descriptor address within the table pointed to by
// the table base
bits(52) index;
lsb = levels*stride + granulebits;
msb = Min(iasize - 1, (lsb + stride) - 1);
index = ZeroExtend(ia<msb:lsb>:Zeros(3));
FullAddress descaddress;
descaddress.address = tablebase.address OR index;
descaddress.paspace = tablebase.paspace;
return descaddress;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-403
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/vmsa_faults/AArch64.AddrTop
// AArch64.AddrTop()
// =================
// Get the top bit position of the virtual address.
// Bits above are not accounted as part of the translation process.
aarch64/translation/vmsa_faults/AArch64.ContiguousBitFaults
// AArch64.ContiguousBitFaults()
// =============================
// If contiguous bit is set, returns whether the translation size exceeds the
// input address size and if the implementation generates a fault
aarch64/translation/vmsa_faults/AArch64.DebugFault
// AArch64.DebugFault()
// ====================
// Return a fault record indicating a hardware watchpoint/breakpoint
fault.statuscode = Fault_Debug;
fault.acctype = acctype;
fault.write = iswrite;
fault.secondstage = FALSE;
fault.s2fs1walk = FALSE;
return fault;
aarch64/translation/vmsa_faults/AArch64.OAOutOfRange
// AArch64.OAOutOfRange()
// ======================
// Returns whether output address is expressed in the configured size number of bits
I1-404 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return !IsZero(baseaddress<51:oasize>);
else
// Output address
oa = StageOA(ia, tgx, walkstate);
return !IsZero(oa.address<51:oasize>);
else
return FALSE;
aarch64/translation/vmsa_faults/AArch64.S1HasAlignmentFault
// AArch64.S1HasAlignmentFault()
// =============================
// Returns whether stage 1 output fails alignment requirement on data accesses
// to Device memory
aarch64/translation/vmsa_faults/AArch64.S1HasPermissionsFault_VMSA
// AArch64.S1HasPermissionsFault_VMSA()
// ====================================
// Returns whether stage 1 access violates permissions of target memory
if HasUnprivileged(regime) then
bit pr;
bit pw;
bit ur;
bit uw;
// Apply leaf permissions
case permissions.ap<2:1> of
when '00' (pr,pw,ur,uw) = ('1','1','0','0'); // Privileged access
when '01' (pr,pw,ur,uw) = ('1','1','1','1'); // No effect
when '10' (pr,pw,ur,uw) = ('1','0','0','0'); // Read-only, privileged access
when '11' (pr,pw,ur,uw) = ('1','0','1','0'); // Read-only
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-405
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
pw = pw AND NOT(pan);
x = NOT(permissions.xn OR permissions.xn_table);
return x == '0';
elsif acctype == AccType_DC then
if iswrite then
return w == '0';
else
// DC from privileged context which do no write cannot Permission fault
return !ispriv && r == '0';
elsif acctype == AccType_IC then
// IC instructions do not write
assert !iswrite;
impdef_ic_fault = boolean IMPLEMENTATION_DEFINED "Permission fault on EL0 IC_IVAU execution";
if AArch64.IsStage1VMSA(regime) then
// Apply hierarchical permissions for stage 1 VMSA
case permissions.ap_table of
when '00' (pr,pw,ur,uw) = ( pr, pw, ur, uw); // No effect
when '01' (pr,pw,ur,uw) = ( pr, pw,'0','0'); // Privileged access
when '10' (pr,pw,ur,uw) = ( pr,'0', ur,'0'); // Read-only
when '11' (pr,pw,ur,uw) = ( pr,'0','0','0'); // Read-only, privileged access
I1-406 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
bit pan;
if HavePANExt() && AArch64.S1Enabled(regime) && pan_access then
pan = PSTATE.PAN AND (ur OR uw);
else
pan = '0';
pr = pr AND NOT(pan);
pw = pw AND NOT(pan);
(r,w,x) = if ispriv then (pr,pw,px) else (ur,uw,ux);
else
// Apply MPU permissions given Translation Regime serves 1 EL
case permissions.ap<2> of
when '0' (r,w) = ('1','1'); // No effect
when '1' (r,w) = ('1','0'); // Read-only
x = NOT(permissions.xn);
return x == '0';
elsif acctype == AccType_DC then
if iswrite then
return w == '0';
else
// DC from privileged context which do no write cannot Permission fault
return !ispriv && r == '0';
elsif acctype == AccType_IC then
// IC instructions do not write
assert !iswrite;
impdef_ic_fault = boolean IMPLEMENTATION_DEFINED "Permission fault on EL0 IC_IVAU execution";
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-407
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/vmsa_faults/AArch64.S1InvalidTxSZ
// AArch64.S1InvalidTxSZ()
// =======================
// Detect erroneous configuration of stage 1 TxSZ field if the implementation
// does not constrain the value of TxSZ
aarch64/translation/vmsa_faults/AArch64.S2HasAlignmentFault
// AArch64.S2HasAlignmentFault()
// =============================
// Returns whether stage 2 output fails alignment requirement on data accesses
// to Device memory
I1-408 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/vmsa_faults/AArch64.VAIsOutOfRange
// AArch64.VAIsOutOfRange()
// ========================
// Check bits not resolved by translation are identical and of accepted value
if HasUnprivileged(regime) then
if AArch64.GetVARange(va) == VARange_LOWER then
return !IsZero(va<addrtop:iasize>);
else
return !IsOnes(va<addrtop:iasize>);
else
return !IsZero(va<addrtop:iasize>);
aarch64/translation/vmsa_memattr/AArch64.S2ApplyFWBMemAttrs
// AArch64.S2ApplyFWBMemAttrs()
// ============================
// Apply stage 2 transformation on stage 1 memory attributes using FWB mapping.
memattrs.inner.attrs = MemAttr_WB;
if (s1_memattrs.memtype == MemType_Normal &&
s1_memattrs.inner.attrs != MemAttr_NC) then
memattrs.inner.hints = s1_memattrs.inner.hints;
memattrs.inner.transient = s1_memattrs.inner.transient;
else
memattrs.inner.hints = MemHint_RWA;
memattrs.inner.transient = FALSE;
memattrs.outer.attrs = MemAttr_WB;
if (s1_memattrs.memtype == MemType_Normal &&
s1_memattrs.outer.attrs != MemAttr_NC) then
memattrs.outer.hints = s1_memattrs.outer.hints;
memattrs.outer.transient = s1_memattrs.outer.transient;
else
memattrs.outer.hints = MemHint_RWA;
memattrs.outer.transient = FALSE;
s2_shareability = DecodeShareability(s2_sh);
memattrs.shareability = S2CombineS1Shareability(s1_memattrs.shareability, s2_shareability);
else
// Follow memory decoding & combining rules as if FWB is inactive
// V8R stage 2 memory attributes are decoded in the same fashion as stage 1
// for the EL2 regime. The only difference is allocation hints are ignored
s1aarch64 = TRUE;
s2_memattrs = S1DecodeMemAttrs(s2_attr, s2_sh, s1aarch64);
memattrs = S2CombineS1MemAttrs(s1_memattrs, s2_memattrs);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-409
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
return memattrs;
aarch64/translation/vmsa_tlbcontext/AArch64.GetS1TLBContext
// AArch64.GetS1TLBContext()
// =========================
// Gather translation context for accesses with VA to match against TLB entries
case regime of
when Regime_EL2 tlbcontext = AArch64.TLBContextEL2(ss, va, tg);
when Regime_EL10 tlbcontext = AArch64.TLBContextEL10(ss, va, tg);
tlbcontext.includes_s1 = TRUE;
// The following may be amended for EL1&0 Regime if caching of stage 2 is successful
tlbcontext.includes_s2 = FALSE;
return tlbcontext;
aarch64/translation/vmsa_tlbcontext/AArch64.GetS2TLBContext
// AArch64.GetS2TLBContext()
// =========================
// Gather translation context for accesses with IPA to match against TLB entries
TLBContext tlbcontext;
tlbcontext.ss = ss;
tlbcontext.regime = Regime_EL10;
tlbcontext.ipaspace = ipa.paspace;
tlbcontext.vmid = VMID[];
tlbcontext.tg = tg;
tlbcontext.ia = ZeroExtend(ipa.address);
if HaveCommonNotPrivateTransExt() && VTCR_EL2.MSA == '1' then
tlbcontext.cnp = VSCTLR_EL2.CnP;
else
tlbcontext.cnp = '0';
tlbcontext.includes_s1 = FALSE;
tlbcontext.includes_s2 = TRUE;
return tlbcontext;
aarch64/translation/vmsa_tlbcontext/AArch64.TLBContextEL10
// AArch64.TLBContextEL10()
// ========================
// Gather translation context for accesses under EL10 regime to match against TLB entries
tlbcontext.ss = ss;
tlbcontext.regime = Regime_EL10;
tlbcontext.vmid = VMID[];
I1-410 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
tlbcontext.asid = TTBR1_EL1.ASID;
tlbcontext.tg = tg;
tlbcontext.ia = va;
return tlbcontext;
aarch64/translation/vmsa_tlbcontext/AArch64.TLBContextEL2
// AArch64.TLBContextEL2()
// =======================
// Gather translation context for accesses under EL2 regime to match against TLB entries
tlbcontext.ss = ss;
tlbcontext.regime = Regime_EL2;
tlbcontext.tg = tg;
tlbcontext.ia = va;
return tlbcontext;
aarch64/translation/vmsa_translation/AArch64.AccessUsesEL
// AArch64.AccessUsesEL()
// ======================
// Returns the Exception Level of the regime that will manage the translation for a given access type.
aarch64/translation/vmsa_translation/AArch64.FaultAllowsSetAccessFlag
// AArch64.FaultAllowsSetAccessFlag()
// ==================================
// Determine whether the access flag could be set by HW given the fault status
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-411
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/vmsa_translation/AArch64.MemSwapTableDesc
// AArch64.MemSwapTableDesc()
// ==========================
// Perform HW update of table descriptor as an atomic operation
if IsFault(memstatus) then
iswrite = FALSE;
fault = HandleExternalTTWAbort(memstatus, iswrite, descupdateaddress, descupdateaccess,
8, fault);
if IsFault(fault.statuscode) then
fault.acctype = AccType_ATOMICRW;
return (fault, bits(64) UNKNOWN);
if IsFault(memstatus) then
iswrite = TRUE;
fault = HandleExternalTTWAbort(memstatus, iswrite, descupdateaddress, descupdateaccess,
8, fault);
fault.acctype = memstatus.acctype;
if IsFault(fault.statuscode) then
fault.acctype = AccType_ATOMICRW;
return (fault, bits(64) UNKNOWN);
aarch64/translation/vmsa_translation/AArch64.S1DisabledOutput
// AArch64.S1DisabledOutput()
// ==========================
// Map the the VA to IPA/PA and assign default memory attributes
bit tbi;
bit tbid;
FaultRecord fault = fault_in;
case regime of
when Regime_EL2
tbi = TCR_EL2.TBI;
tbid = TCR_EL2.TBID;
when Regime_EL10
if AArch64.IsStage1VMSA(regime) then
if AArch64.GetVARange(va) == VARange_LOWER then
tbi = TCR_EL1.TBI0;
I1-412 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
tbid = TCR_EL1.TBID0;
else
tbi = TCR_EL1.TBI1;
tbid = TCR_EL1.TBID1;
else
tbi = TCR_EL1.TBI0;
tbid = TCR_EL1.TBID0;
// Output Address
FullAddress oa;
oa.address = va<51:0>;
if ss == SS_Secure then
oa.paspace = PAS_Secure;
else
oa.paspace = PAS_NonSecure;
MemoryAttributes memattrs;
if regime == Regime_EL10 && EL2Enabled() && HCR_EL2.DC == '1' then
MemAttrHints default_cacheability;
default_cacheability.attrs = MemAttr_WB;
default_cacheability.hints = MemHint_RWA;
default_cacheability.transient = FALSE;
memattrs.memtype = MemType_Normal;
memattrs.outer = default_cacheability;
memattrs.inner = default_cacheability;
memattrs.shareability = Shareability_NSH;
elsif acctype == AccType_IFETCH then
MemAttrHints i_cache_attr;
if AArch64.S1ICacheEnabled(regime) then
i_cache_attr.attrs = MemAttr_WT;
i_cache_attr.hints = MemHint_RA;
i_cache_attr.transient = FALSE;
else
i_cache_attr.attrs = MemAttr_NC;
memattrs.memtype = MemType_Normal;
memattrs.outer = i_cache_attr;
memattrs.inner = i_cache_attr;
memattrs.shareability = Shareability_OSH;
else
memattrs.memtype = MemType_Device;
memattrs.device = DeviceType_nGnRnE;
memattrs.shareability = Shareability_OSH;
fault.level = 0;
addrtop = AArch64.AddrTop(tbid, acctype, tbi);
if !IsZero(va<addrtop:AArch64.PAMax()>) then
fault.statuscode = Fault_AddressSize;
elsif AArch64.S1HasAlignmentFault(acctype, aligned, memattrs) then
fault.statuscode = Fault_Alignment;
aarch64/translation/vmsa_translation/AArch64.S1Translate
// AArch64.S1Translate()
// =====================
// Translate VA to IPA/PA depending on the regime
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-413
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
if !AArch64.S1Enabled(regime) then
return AArch64.S1DisabledOutput(fault, regime, ss, va, acctype, aligned);
if (AArch64.S1InvalidTxSZ(walkparams) ||
(!ispriv && walkparams.e0pd == '1') ||
AArch64.VAIsOutOfRange(va, acctype, regime, walkparams)) then
fault.statuscode = Fault_Translation;
fault.level = 0;
return (fault, AddressDescriptor UNKNOWN);
AddressDescriptor descaddress;
TTWState walkstate;
bits(64) descriptor;
bits(64) new_desc;
bits(64) mem_desc;
repeat
(fault, descaddress, walkstate, descriptor) = AArch64.S1Walk(fault, walkparams, va, regime,
ss, acctype, iswrite, ispriv);
if AArch64.S1HasAlignmentFault(acctype, aligned,
walkstate.memattrs) then
fault.statuscode = Fault_Alignment;
elsif IsAtomicRW(acctype) then
if AArch64.S1HasPermissionsFault_VMSA(regime, ss, walkstate, walkparams,
ispriv, acctype, FALSE) then
// The Permission fault was not caused by lack of write permissions
fault.statuscode = Fault_Permission;
fault.write = FALSE;
elsif AArch64.S1HasPermissionsFault_VMSA(regime, ss, walkstate, walkparams,
ispriv, acctype, TRUE) then
// The Permission fault was caused by lack of write permissions
fault.statuscode = Fault_Permission;
fault.write = TRUE;
elsif AArch64.S1HasPermissionsFault_VMSA(regime, ss, walkstate, walkparams,
ispriv, acctype, iswrite) then
fault.statuscode = Fault_Permission;
new_desc = descriptor;
if walkparams.ha == '1' && AArch64.FaultAllowsSetAccessFlag(fault) then
// Set descriptor AF bit
new_desc<10> = '1';
I1-414 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
AddressDescriptor descupdateaddress;
FaultRecord s2fault;
// Either the access flag was clear or AP<2> is set
if new_desc != descriptor then
s2fs1walk = TRUE;
aligned = TRUE;
iswrite = TRUE;
(s2fault, descupdateaddress) = AArch64.S2Validate(fault, descaddress, s2fs1walk,
AccType_ATOMICRW, aligned,
iswrite, ispriv);
// Output Address
oa = StageOA(va, walkparams.tgx, walkstate);
MemoryAttributes memattrs;
if (acctype == AccType_IFETCH &&
(walkstate.memattrs.memtype == MemType_Device || !AArch64.S1ICacheEnabled(regime))) then
// Treat memory attributes as Normal Non-Cacheable
memattrs = NormalNCMemAttr();
elsif (acctype != AccType_IFETCH && !AArch64.S1DCacheEnabled(regime) &&
walkstate.memattrs.memtype == MemType_Normal) then
// Treat memory attributes as Normal Non-Cacheable
memattrs = NormalNCMemAttr();
else
memattrs = walkstate.memattrs;
aarch64/translation/vmsa_translation/AArch64.TranslateAddress
// AArch64.TranslateAddress()
// ==========================
// Main entry point for translating an address
if !IsFault(result) then
result.fault = AArch64.CheckDebug(va, acctype, iswrite, size);
return result;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-415
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/vmsa_ttentry/AArch64.BlockDescSupported
// AArch64.BlockDescSupported()
// ============================
// Determine whether a block descriptor is valid for the given granule size
// and level
return FALSE;
aarch64/translation/vmsa_ttentry/AArch64.BlocknTFaults
// AArch64.BlocknTFaults()
// =======================
// Identify whether the nT bit in a block descriptor is effectively set
// causing a translation fault
bbm_level = AArch64.BlockBBMSupportLevel();
nT_faults = boolean IMPLEMENTATION_DEFINED "BBM level 1 or 2 support nT bit causes Translation
Fault";
aarch64/translation/vmsa_ttentry/AArch64.ContiguousBit
// AArch64.ContiguousBit()
// =======================
// Get the value of the contiguous bit
return descriptor<52>;
aarch64/translation/vmsa_ttentry/AArch64.DecodeDescriptorType
// AArch64.DecodeDescriptorType()
// ==============================
// Determine whether the descriptor is a page, block or table
I1-416 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
else
return DescriptorType_Invalid;
aarch64/translation/vmsa_ttentry/AArch64.S1ApplyOutputPerms
// AArch64.S1ApplyOutputPerms()
// ============================
// Apply output permissions encoded in stage 1 page/block descriptors
// Descriptors marked with DBM set have the effective value of AP[2] cleared.
// This implies no Permission faults caused by lack of write permissions are
// reported, and the Dirty bit can be set.
if walkparams.ha == '1' && walkparams.hd == '1' && descriptor<51> == '1' then
permissions.ap<2> = '0';
return permissions;
aarch64/translation/vmsa_ttentry/AArch64.S1ApplyTablePerms
// AArch64.S1ApplyTablePerms()
// ===========================
// Apply hierarchical permissions encoded in stage 1 table descriptors
return permissions;
aarch64/translation/vmsa_walk/AArch64.S1InitialTTWState
// AArch64.S1InitialTTWState()
// ===========================
// Set properties of first access to translation tables in stage 1
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-417
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
SecurityState ss)
TTWState walkstate;
FullAddress tablebase;
Permissions permissions;
startlevel = AArch64.S1StartLevel(walkparams);
ttbr = AArch64.S1TTBR(regime, va);
tablebase.paspace = PAS_Secure;
permissions.ap_table = Zeros();
if HasUnprivileged(regime) then
permissions.uxn_table = Zeros();
permissions.pxn_table = Zeros();
else
permissions.xn_table = Zeros();
walkstate.baseaddress = tablebase;
walkstate.level = startlevel;
walkstate.istable = TRUE;
// In regimes that support global and non-global translations, translation
// table entries from lookup levels other than the final level of lookup
// are treated as being non-global
walkstate.nG = if HasUnprivileged(regime) then '1' else '0';
walkstate.memattrs = WalkMemAttrs(walkparams.sh, walkparams.irgn, walkparams.orgn);
walkstate.permissions = permissions;
return walkstate;
aarch64/translation/vmsa_walk/AArch64.S1NextWalkStateLast
// AArch64.S1NextWalkStateLast()
// =============================
// Decode stage 1 page or block descriptor as output to this stage of translation
nextstate.istable = FALSE;
nextstate.level = currentstate.level;
nextstate.baseaddress = baseaddress;
attrindx = descriptor<4:2>;
sh = descriptor<9:8>;
attr = MAIRAttr(UInt(attrindx), walkparams.mair);
s1aarch64 = TRUE;
I1-418 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
if !HasUnprivileged(regime) then
nextstate.nG = '0';
elsif ss == SS_Secure && currentstate.baseaddress.paspace == PAS_NonSecure then
// In Secure state, a translation must be treated as non-global,
// regardless of the value of the nG bit,
// if NSTable is set to 1 at any level of the translation table walk
nextstate.nG = '1';
else
nextstate.nG = descriptor<11>;
return nextstate;
aarch64/translation/vmsa_walk/AArch64.S1NextWalkStateTable
// AArch64.S1NextWalkStateTable()
// ==============================
// Decode stage 1 table descriptor to transition to the next level
nextstate.istable = TRUE;
nextstate.nG = currentstate.nG;
nextstate.level = currentstate.level + 1;
nextstate.baseaddress = tablebase;
nextstate.memattrs = currentstate.memattrs;
return nextstate;
aarch64/translation/vmsa_walk/AArch64.S1Walk
// AArch64.S1Walk()
// ================
// Traverse stage 1 translation tables obtaining the final descriptor
// as well as the address leading to that descriptor
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-419
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
bits(64) descriptor;
AddressDescriptor walkaddress;
walkaddress.vaddress = va;
if !AArch64.S1DCacheEnabled(regime) then
walkaddress.memattrs = NormalNCMemAttr();
else
walkaddress.memattrs = walkstate.memattrs;
DescriptorType desctype;
repeat
fault.level = walkstate.level;
FullAddress descaddress = AArch64.TTEntryAddress(walkstate.level, walkparams.tgx,
walkparams.txsz, va,
walkstate.baseaddress);
walkaddress.paddress = descaddress;
s2fs1walk = TRUE;
aligned = TRUE;
iswrite = FALSE;
(s2fault, s2walkaddress) = AArch64.S2Validate(fault, walkaddress, s2fs1walk,
AccType_TTW, aligned, iswrite, ispriv);
case desctype of
when DescriptorType_Table
walkstate = AArch64.S1NextWalkStateTable(walkstate, regime, walkparams,
descriptor);
when DescriptorType_Invalid
fault.statuscode = Fault_Translation;
return (fault, AddressDescriptor UNKNOWN, TTWState UNKNOWN, bits(64) UNKNOWN);
I1-420 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
otherwise
Unreachable();
aarch64/translation/vmsa_walkparams/AArch64.BBMSupportLevel
// AArch64.BBMSupportLevel()
// =========================
// Returns the level of FEAT_BBM supported
integer AArch64.BlockBBMSupportLevel()
if !HaveBlockBBM() then
return integer UNKNOWN;
else
return integer IMPLEMENTATION_DEFINED "Block BBM support level";
aarch64/translation/vmsa_walkparams/AArch64.DecodeTG0
// AArch64.DecodeTG0()
// ===================
// Decode granule size configuration bits TG0
case tg0 of
when '00' return TGx_4KB;
when '01' return TGx_64KB;
when '10' return TGx_16KB;
aarch64/translation/vmsa_walkparams/AArch64.DecodeTG1
// AArch64.DecodeTG1()
// ===================
// Decode granule size configuration bits TG1
case tg1 of
when '10' return TGx_4KB;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-421
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/vmsa_walkparams/AArch64.GetS1TTWParams
// AArch64.GetS1TTWParams()
// ========================
// Returns stage 1 translation table walk parameters from respective controlling
// system registers.
varange = AArch64.GetVARange(va);
case regime of
when Regime_EL10 walkparams = AArch64.S1TTWParamsEL10(varange);
maxtxsz = AArch64.MaxTxSZ(walkparams.tgx);
mintxsz = AArch64.S1MinTxSZ( walkparams.tgx);
if UInt(walkparams.txsz) > maxtxsz then
if !(boolean IMPLEMENTATION_DEFINED "Fault on TxSZ value above maximum") then
walkparams.txsz = maxtxsz<5:0>;
elsif !Have52BitVAExt() && UInt(walkparams.txsz) < mintxsz then
if !(boolean IMPLEMENTATION_DEFINED "Fault on TxSZ value below minimum") then
walkparams.txsz = mintxsz<5:0>;
return walkparams;
aarch64/translation/vmsa_walkparams/AArch64.GetVARange
// AArch64.GetVARange()
// ====================
// Determines if the VA that is to be translated lies in LOWER or UPPER address range.
aarch64/translation/vmsa_walkparams/AArch64.MaxTxSZ
// AArch64.MaxTxSZ()
// =================
// Retrieve the maximum value of TxSZ indicating minimum input address size for both
// stages of translation
aarch64/translation/vmsa_walkparams/AArch64.PAMax
// AArch64.PAMax()
// ===============
// Returns the IMPLEMENTATION DEFINED maximum number of bits capable of representing
I1-422 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
integer AArch64.PAMax()
return integer IMPLEMENTATION_DEFINED "Maximum Physical Address Size";
aarch64/translation/vmsa_walkparams/AArch64.S1BREnabled
// AArch64.S1BREnabled()
// =====================
// Determine the number of MPUs supported in PMSA stage 1 for given regime
aarch64/translation/vmsa_walkparams/AArch64.S1DCacheEnabled
// AArch64.S1DCacheEnabled()
// =========================
// Determine cacheability of stage 1 data accesses
aarch64/translation/vmsa_walkparams/AArch64.S1EPD
// AArch64.S1EPD()
// ===============
// Determine whether stage 1 translation table walk is allowed for the VA range
case regime of
when Regime_EL10 return if varange == VARange_LOWER then TCR_EL1.EPD0 else TCR_EL1.EPD1;
aarch64/translation/vmsa_walkparams/AArch64.S1Enabled
// AArch64.S1Enabled()
// ===================
// Determine if stage 1 for the acting translation regime is enabled
aarch64/translation/vmsa_walkparams/AArch64.S1ICacheEnabled
// AArch64.S1ICacheEnabled()
// =========================
// Determine cacheability of stage 1 instruction fetches
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-423
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
aarch64/translation/vmsa_walkparams/AArch64.S1MinTxSZ
// AArch64.S1MinTxSZ()
// ===================
// Retrieve the minimum value of TxSZ indicating maximum input address size for stage 1
return 16;
aarch64/translation/vmsa_walkparams/AArch64.S1TTBR
// AArch64.S1TTBR()
// ================
// Identify stage 1 table base register for the acting translation regime
case regime of
when Regime_EL10 return if varange == VARange_LOWER then TTBR0_EL1 else TTBR1_EL1;
aarch64/translation/vmsa_walkparams/AArch64.S1TTWParamsEL10
// AArch64.S1TTWParamsEL10()
// =========================
// Gather stage 1 translation table walk parameters for EL1&0 regime
// (with EL2 enabled or disabled)
walkparams.mair = MAIR_EL1;
walkparams.wxn = SCTLR_EL1.WXN;
walkparams.ps = TCR_EL1.IPS;
I1-424 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.1 Pseudocode for AArch64 operations
walkparams.ee = SCTLR_EL1.EE;
if EL2Enabled() then
walkparams.dc = HCR_EL2.DC;
return walkparams;
aarch64/translation/vmsa_walkparams/AArch64.S2MinTxSZ
// AArch64.S2MinTxSZ()
// ===================
// Retrieve the minimum value of TxSZ indicating maximum input address size for stage 2
min_txsz = 64 - ips;
if !s1aarch64 then
// EL1 is AArch32
min_txsz = Min(min_txsz, 24);
return min_txsz;
aarch64/translation/vmsa_walkparams/AArch64.VAMax
// AArch64.VAMax()
// ===============
// Returns the IMPLEMENTATION DEFINED maximum number of bits capable of representing
// the virtual address for this processor
integer AArch64.VAMax()
return integer IMPLEMENTATION_DEFINED "Maximum Virtual Address Size";
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-425
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
The functions listed in this section are identified only by a FunctionName. This section is organized by functional
groups, with the functional groups being indicated by hierarchical path names, for example
shared/debug/DebugTarget.
I1.2.1 shared/debug
This section includes the following pseudocode functions:
• shared/debug/ClearStickyErrors/ClearStickyErrors on page I1-427.
• shared/debug/DebugTarget/DebugTarget on page I1-428.
• shared/debug/DebugTarget/DebugTargetFrom on page I1-428.
• shared/debug/DoubleLockStatus/DoubleLockStatus on page I1-428.
• shared/debug/OSLockStatus/OSLockStatus on page I1-429.
• shared/debug/SoftwareLockStatus/Component on page I1-429.
• shared/debug/SoftwareLockStatus/GetAccessComponent on page I1-429.
• shared/debug/SoftwareLockStatus/SoftwareLockStatus on page I1-429.
• shared/debug/authentication/AccessState on page I1-429.
• shared/debug/authentication/AllowExternalDebugAccess on page I1-429.
• shared/debug/authentication/AllowExternalPMUAccess on page I1-430.
• shared/debug/authentication/Debug_authentication on page I1-430.
• shared/debug/authentication/ExternalInvasiveDebugEnabled on page I1-430.
• shared/debug/authentication/ExternalNoninvasiveDebugAllowed on page I1-430.
• shared/debug/authentication/ExternalNoninvasiveDebugEnabled on page I1-431.
• shared/debug/authentication/ExternalSecureInvasiveDebugEnabled on page I1-431.
• shared/debug/authentication/ExternalSecureNoninvasiveDebugEnabled on page I1-431.
• shared/debug/authentication/IsAccessSecure on page I1-431.
• shared/debug/authentication/IsCorePowered on page I1-431.
• shared/debug/breakpoint/CheckValidStateMatch on page I1-432.
• shared/debug/breakpoint/NumBreakpointsImplemented on page I1-432.
• shared/debug/breakpoint/NumContextAwareBreakpointsImplemented on page I1-433.
• shared/debug/breakpoint/NumWatchpointsImplemented on page I1-433.
• shared/debug/cti/CTI_SetEventLevel on page I1-433.
• shared/debug/cti/CTI_SignalEvent on page I1-433.
• shared/debug/cti/CrossTrigger on page I1-433.
• shared/debug/dccanditr/CheckForDCCInterrupts on page I1-433.
• shared/debug/dccanditr/DBGDTRRX_EL0 on page I1-434.
• shared/debug/dccanditr/DBGDTRTX_EL0 on page I1-434.
• shared/debug/dccanditr/DBGDTR_EL0 on page I1-435.
• shared/debug/dccanditr/DTR on page I1-436.
• shared/debug/dccanditr/EDITR on page I1-436.
I1-426 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/debug/ClearStickyErrors/ClearStickyErrors
// ClearStickyErrors()
// ===================
ClearStickyErrors()
EDSCR.TXU = '0'; // Clear TX underrun flag
EDSCR.RXO = '0'; // Clear RX overrun flag
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-427
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// If halted and the ITR is not empty then it is UNPREDICTABLE whether the EDSCR.ERR is cleared.
// The UNPREDICTABLE behavior also affects the instructions in flight, but this is not described
// in the pseudocode.
if Halted() && EDSCR.ITE == '0' && ConstrainUnpredictableBool() then
return;
EDSCR.ERR = '0'; // Clear cumulative error flag
return;
shared/debug/DebugTarget/DebugTarget
// DebugTarget()
// =============
// Returns the debug exception target Exception level
bits(2) DebugTarget()
ss = CurrentSecurityState();
return DebugTargetFrom(ss);
shared/debug/DebugTarget/DebugTargetFrom
// DebugTargetFrom()
// =================
bits(2) target;
if route_to_el2 then
target = EL2;
elsif HaveEL(EL3) && !HaveAArch64() && from_state == SS_Secure then
target = EL3;
else
target = EL1;
return target;
shared/debug/DoubleLockStatus/DoubleLockStatus
// DoubleLockStatus()
// ==================
// Returns the state of the OS Double Lock.
// FALSE if OSDLR_EL1.DLK == 0 or DBGPRCR_EL1.CORENPDRQ == 1 or the PE is in Debug state.
// TRUE if OSDLR_EL1.DLK == 1 and DBGPRCR_EL1.CORENPDRQ == 0 and the PE is in Non-debug state.
boolean DoubleLockStatus()
if !HaveDoubleLock() then
return FALSE;
elsif ELUsingAArch32(EL1) then
return DBGOSDLR.DLK == '1' && DBGPRCR.CORENPDRQ == '0' && !Halted();
else
return OSDLR_EL1.DLK == '1' && DBGPRCR_EL1.CORENPDRQ == '0' && !Halted();
I1-428 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/debug/OSLockStatus/OSLockStatus
// OSLockStatus()
// ==============
// Returns the state of the OS Lock.
boolean OSLockStatus()
return (if ELUsingAArch32(EL1) then DBGOSLSR.OSLK else OSLSR_EL1.OSLK) == '1';
shared/debug/SoftwareLockStatus/Component
enumeration Component {
Component_PMU,
Component_Debug,
Component_CTI
};
shared/debug/SoftwareLockStatus/GetAccessComponent
// Returns the accessed component.
Component GetAccessComponent();
shared/debug/SoftwareLockStatus/SoftwareLockStatus
// SoftwareLockStatus()
// ====================
// Returns the state of the Software Lock.
boolean SoftwareLockStatus()
Component component = GetAccessComponent();
if !HaveSoftwareLock(component) then
return FALSE;
case component of
when Component_Debug
return EDLSR.SLK == '1';
when Component_PMU
return PMLSR.SLK == '1';
when Component_CTI
return CTILSR.SLK == '1';
otherwise
Unreachable();
shared/debug/authentication/AccessState
// Returns the Security state of the access.
SecurityState AccessState();
shared/debug/authentication/AllowExternalDebugAccess
// AllowExternalDebugAccess()
// ==========================
// Returns TRUE if an external debug interface access to the External debug registers
// is allowed, FALSE otherwise.
boolean AllowExternalDebugAccess()
// The access may also be subject to OS Lock, power-down, etc.
return AllowExternalDebugAccess(AccessState());
// AllowExternalDebugAccess()
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-429
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// ==========================
// Returns TRUE if an external debug interface access to the External debug registers
// is allowed for the given Security state, FALSE otherwise.
shared/debug/authentication/AllowExternalPMUAccess
// AllowExternalPMUAccess()
// ========================
// Returns TRUE if an external debug interface access to the PMU registers is
// allowed, FALSE otherwise.
boolean AllowExternalPMUAccess()
// The access may also be subject to OS Lock, power-down, etc.
return AllowExternalPMUAccess(AccessState());
// AllowExternalPMUAccess()
// ========================
// Returns TRUE if an external debug interface access to the PMU registers is
// allowed for the given Security state, FALSE otherwise.
shared/debug/authentication/Debug_authentication
signal DBGEN;
signal NIDEN;
signal SPIDEN;
signal SPNIDEN;
shared/debug/authentication/ExternalInvasiveDebugEnabled
// ExternalInvasiveDebugEnabled()
// ==============================
// The definition of this function is IMPLEMENTATION DEFINED.
// In the recommended interface, this function returns the state of the DBGEN signal.
boolean ExternalInvasiveDebugEnabled()
return DBGEN == HIGH;
shared/debug/authentication/ExternalNoninvasiveDebugAllowed
// ExternalNoninvasiveDebugAllowed()
// =================================
// Returns TRUE if Trace and PC Sample-based Profiling are allowed
boolean ExternalNoninvasiveDebugAllowed()
if !ExternalNoninvasiveDebugEnabled() then return FALSE;
I1-430 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
ss = SecurityStateAtEL(PSTATE.EL);
if (ELUsingAArch32(EL1) && PSTATE.EL == EL0 &&
ss == SS_Secure && SDER.SUNIDEN == '1') then
return TRUE;
case ss of
when SS_NonSecure return TRUE;
when SS_Secure return ExternalSecureNoninvasiveDebugEnabled();
shared/debug/authentication/ExternalNoninvasiveDebugEnabled
// ExternalNoninvasiveDebugEnabled()
// =================================
// This function returns TRUE if the FEAT_Debugv8p4 is implemented.
// Otherwise, this function is IMPLEMENTATION DEFINED, and, in the
// recommended interface, ExternalNoninvasiveDebugEnabled returns
// the state of the (DBGEN OR NIDEN) signal.
boolean ExternalNoninvasiveDebugEnabled()
return !HaveNoninvasiveDebugAuth() || ExternalInvasiveDebugEnabled() || NIDEN == HIGH;
shared/debug/authentication/ExternalSecureInvasiveDebugEnabled
// ExternalSecureInvasiveDebugEnabled()
// ====================================
// The definition of this function is IMPLEMENTATION DEFINED.
// In the recommended interface, this function returns the state of the (DBGEN AND SPIDEN) signal.
// CoreSight allows asserting SPIDEN without also asserting DBGEN, but this is not recommended.
boolean ExternalSecureInvasiveDebugEnabled()
if !HaveEL(EL3) && !SecureOnlyImplementation() then return FALSE;
return ExternalInvasiveDebugEnabled() && SPIDEN == HIGH;
shared/debug/authentication/ExternalSecureNoninvasiveDebugEnabled
// ExternalSecureNoninvasiveDebugEnabled()
// =======================================
// This function returns the value of ExternalSecureInvasiveDebugEnabled() when FEAT_Debugv8p4
// is implemented. Otherwise, the definition of this function is IMPLEMENTATION DEFINED.
// In the recommended interface, this function returns the state of the (DBGEN OR NIDEN) AND
// (SPIDEN OR SPNIDEN) signal.
boolean ExternalSecureNoninvasiveDebugEnabled()
if !HaveEL(EL3) && !SecureOnlyImplementation() then return FALSE;
if HaveNoninvasiveDebugAuth() then
return ExternalNoninvasiveDebugEnabled() && (SPIDEN == HIGH || SPNIDEN == HIGH);
else
return ExternalSecureInvasiveDebugEnabled();
shared/debug/authentication/IsAccessSecure
// Returns TRUE when an access is Secure
boolean IsAccessSecure();
shared/debug/authentication/IsCorePowered
// Returns TRUE if the Core power domain is powered on, FALSE otherwise.
boolean IsCorePowered();
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-431
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/debug/breakpoint/CheckValidStateMatch
// CheckValidStateMatch()
// ======================
// Checks for an invalid state match that will generate Constrained
// Unpredictable behaviour, otherwise returns Constraint_NONE.
(Constraint, bits(2), bit, bits(2)) CheckValidStateMatch(bits(2) SSC_in, bit HMC_in, bits(2) PxC_in,
boolean isbreakpnt)
boolean reserved = FALSE;
bits(2) SSC = SSC_in;
bit HMC = HMC_in;
bits(2) PxC = PxC_in;
if reserved then
// If parameters are set to a reserved type, behaves as either disabled or a defined type
Constraint c;
(c, <HMC,SSC,PxC>) = ConstrainUnpredictableBits();
assert c IN {Constraint_DISABLED, Constraint_UNKNOWN};
if c == Constraint_DISABLED then
return (c, bits(2) UNKNOWN, bit UNKNOWN, bits(2) UNKNOWN);
// Otherwise the value returned by ConstrainUnpredictableBits must be a not-reserved value
shared/debug/breakpoint/NumBreakpointsImplemented
// NumBreakpointsImplemented()
// ===========================
// Returns the number of breakpoints implemented. This is indicated to software by
// DBGDIDR.BRPs in AArch32 state, and ID_AA64DFR0_EL1.BRPs in AArch64 state.
integer NumBreakpointsImplemented()
return integer IMPLEMENTATION_DEFINED "Number of breakpoints";
I1-432 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/debug/breakpoint/NumContextAwareBreakpointsImplemented
// NumContextAwareBreakpointsImplemented()
// =======================================
// Returns the number of context-aware breakpoints implemented. This is indicated to software by
// DBGDIDR.CTX_CMPs in AArch32 state, and ID_AA64DFR0_EL1.CTX_CMPs in AArch64 state.
integer NumContextAwareBreakpointsImplemented()
return integer IMPLEMENTATION_DEFINED "Number of context-aware breakpoints";
shared/debug/breakpoint/NumWatchpointsImplemented
// NumWatchpointsImplemented()
// ===========================
// Returns the number of watchpoints implemented. This is indicated to software by
// DBGDIDR.WRPs in AArch32 state, and ID_AA64DFR0_EL1.WRPs in AArch64 state.
integer NumWatchpointsImplemented()
return integer IMPLEMENTATION_DEFINED "Number of watchpoints";
shared/debug/cti/CTI_SetEventLevel
// Set a Cross Trigger multi-cycle input event trigger to the specified level.
CTI_SetEventLevel(CrossTriggerIn id, signal level);
shared/debug/cti/CTI_SignalEvent
// Signal a discrete event on a Cross Trigger input event trigger.
CTI_SignalEvent(CrossTriggerIn id);
shared/debug/cti/CrossTrigger
enumeration CrossTriggerOut {CrossTriggerOut_DebugRequest, CrossTriggerOut_RestartRequest,
CrossTriggerOut_IRQ, CrossTriggerOut_RSVD3,
CrossTriggerOut_TraceExtIn0, CrossTriggerOut_TraceExtIn1,
CrossTriggerOut_TraceExtIn2, CrossTriggerOut_TraceExtIn3};
shared/debug/dccanditr/CheckForDCCInterrupts
// CheckForDCCInterrupts()
// =======================
CheckForDCCInterrupts()
commrx = (EDSCR.RXfull == '1');
commtx = (EDSCR.TXfull == '0');
// COMMRX and COMMTX support is optional and not recommended for new designs.
// SetInterruptRequestLevel(InterruptID_COMMRX, if commrx then HIGH else LOW);
// SetInterruptRequestLevel(InterruptID_COMMTX, if commtx then HIGH else LOW);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-433
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return;
shared/debug/dccanditr/DBGDTRRX_EL0
// DBGDTRRX_EL0[] (external write)
// ===============================
// Called on writes to debug register 0x08C.
if EDSCR.RXfull == '1' || (Halted() && EDSCR.MA == '1' && EDSCR.ITE == '0') then
EDSCR.RXO = '1'; EDSCR.ERR = '1'; // Overrun condition: ignore write
return;
EDSCR.RXfull = '1';
DTRRX = value;
shared/debug/dccanditr/DBGDTRTX_EL0
// DBGDTRTX_EL0[] (external read)
// ==============================
// Called on reads of debug register 0x080.
I1-434 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
underrun = EDSCR.TXfull == '0' || (Halted() && EDSCR.MA == '1' && EDSCR.ITE == '0');
value = if underrun then bits(32) UNKNOWN else DTRTX;
if underrun then
EDSCR.TXU = '1'; EDSCR.ERR = '1'; // Underrun condition: block side-effects
return value; // Return UNKNOWN
EDSCR.TXfull = '0';
if Halted() && EDSCR.MA == '1' then
EDSCR.ITE = '0'; // See comments in EDITR[] (external write)
if !UsingAArch32() then
ExecuteA64(0xB8404401<31:0>); // A64 "LDR W1,[X0],#4"
else
ExecuteT32(0xF850<15:0> /*hw1*/, 0x1B04<15:0> /*hw2*/); // T32 "LDR R1,[R0],#4"
// If the load aborts, the Data Abort exception is taken and EDSCR.ERR is set to 1
if EDSCR.ERR == '1' then
EDSCR.TXfull = bit UNKNOWN;
DBGDTRTX_EL0 = bits(64) UNKNOWN;
else
if !UsingAArch32() then
ExecuteA64(0xD5130501<31:0>); // A64 "MSR DBGDTRTX_EL0,X1"
else
ExecuteT32(0xEE00<15:0> /*hw1*/, 0x1E15<15:0> /*hw2*/); // T32 "MSR DBGDTRTXint,R1"
// "MSR DBGDTRTX_EL0,X1" calls DBGDTR_EL0[] (write) which sets TXfull.
assert EDSCR.TXfull == '1';
if !UsingAArch32() then
X[1] = bits(64) UNKNOWN;
else
R[1] = bits(32) UNKNOWN;
EDSCR.ITE = '1'; // See comments in EDITR[] (external write)
return value;
shared/debug/dccanditr/DBGDTR_EL0
// DBGDTR_EL0[] (write)
// ====================
// System register writes to DBGDTR_EL0, DBGDTRTX_EL0 (AArch64) and DBGDTRTXint (AArch32)
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-435
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
assert N IN {32,64};
if EDSCR.TXfull == '1' then
value = bits(N) UNKNOWN;
// On a 64-bit write, implement a half-duplex channel
if N == 64 then DTRRX = value<63:32>;
DTRTX = value<31:0>; // 32-bit or 64-bit write
EDSCR.TXfull = '1';
return;
// DBGDTR_EL0[] (read)
// ===================
// System register reads of DBGDTR_EL0, DBGDTRRX_EL0 (AArch64) and DBGDTRRXint (AArch32)
bits(N) DBGDTR_EL0[]
// For MRS <Rt>,DBGDTRTX_EL0 N=32, X[t]=Zeros(32):result
// For MRS <Xt>,DBGDTR_EL0 N=64, X[t]=result
assert N IN {32,64};
bits(N) result;
if EDSCR.RXfull == '0' then
result = bits(N) UNKNOWN;
else
// On a 64-bit read, implement a half-duplex channel
// NOTE: the word order is reversed on reads with regards to writes
if N == 64 then result<63:32> = DTRTX;
result<31:0> = DTRRX;
EDSCR.RXfull = '0';
return result;
shared/debug/dccanditr/DTR
bits(32) DTRRX;
bits(32) DTRTX;
shared/debug/dccanditr/EDITR
// EDITR[] (external write)
// ========================
// Called on writes to debug register 0x084.
// ITE indicates whether the processor is ready to accept another instruction; the processor
// may support multiple outstanding instructions. Unlike the "InstrCompl" flag in [v7A] there
// is no indication that the pipeline is empty (all instructions have completed). In this
// pseudocode, the assumption is that only one instruction can be executed at a time,
// meaning ITE acts like "InstrCompl".
EDSCR.ITE = '0';
if !UsingAArch32() then
ExecuteA64(value);
I1-436 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
else
ExecuteT32(value<15:0>/*hw1*/, value<31:16> /*hw2*/);
EDSCR.ITE = '1';
return;
shared/debug/halting/DCPSInstruction
// DCPSInstruction()
// =================
// Operation of the DCPS instruction in Debug state
DCPSInstruction(bits(2) target_el)
SynchronizeContext();
bits(2) handle_el;
case target_el of
when EL1
if PSTATE.EL == EL2 || (PSTATE.EL == EL3 && !UsingAArch32()) then
handle_el = PSTATE.EL;
elsif EL2Enabled() && HCR_EL2.TGE == '1' then
UNDEFINED;
else
handle_el = EL1;
when EL2
if !HaveEL(EL2) then
UNDEFINED;
elsif PSTATE.EL == EL3 && !UsingAArch32() then
handle_el = EL3;
elsif !IsSecureEL2Enabled() && CurrentSecurityState() == SS_Secure then
UNDEFINED;
else
handle_el = EL2;
when EL3
if EDSCR.SDD == '1' || !HaveEL(EL3) then
UNDEFINED;
else
handle_el = EL3;
otherwise
Unreachable();
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-437
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/debug/halting/DRPSInstruction
// DRPSInstruction()
// =================
// Operation of the A64 DRPS and T32 ERET instructions in Debug state
DRPSInstruction()
SynchronizeContext();
DebugRestorePSR();
return;
shared/debug/halting/DebugHalt
constant bits(6) DebugHalt_Breakpoint = '000111';
constant bits(6) DebugHalt_EDBGRQ = '010011';
constant bits(6) DebugHalt_Step_Normal = '011011';
constant bits(6) DebugHalt_Step_Exclusive = '011111';
constant bits(6) DebugHalt_OSUnlockCatch = '100011';
constant bits(6) DebugHalt_ResetCatch = '100111';
constant bits(6) DebugHalt_Watchpoint = '101011';
constant bits(6) DebugHalt_HaltInstruction = '101111';
constant bits(6) DebugHalt_SoftwareAccess = '110011';
constant bits(6) DebugHalt_ExceptionCatch = '110111';
constant bits(6) DebugHalt_Step_NoSyndrome = '111011';
shared/debug/halting/DebugRestorePSR
// DebugRestorePSR()
// =================
I1-438 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
DebugRestorePSR()
// PSTATE.{N,Z,C,V,Q,GE,SS,D,A,I,F} are not observable and ignored in Debug state, so
// behave as if UNKNOWN.
if UsingAArch32() then
bits(32) spsr = SPSR[];
SetPSTATEFromPSR(spsr);
PSTATE.<N,Z,C,V,Q,GE,SS,A,I,F> = bits(13) UNKNOWN;
// In AArch32, all instructions are T32 and unconditional.
PSTATE.IT = '00000000'; PSTATE.T = '1'; // PSTATE.J is RES0
DLR = bits(32) UNKNOWN; DSPSR = bits(32) UNKNOWN;
else
bits(64) spsr = SPSR[];
SetPSTATEFromPSR(spsr);
PSTATE.<N,Z,C,V,SS,D,A,I,F> = bits(9) UNKNOWN;
DLR_EL0 = bits(64) UNKNOWN; DSPSR_EL0 = bits(64) UNKNOWN;
UpdateEDSCRFields(); // Update EDSCR PE state flags
shared/debug/halting/DisableITRAndResumeInstructionPrefetch
DisableITRAndResumeInstructionPrefetch();
shared/debug/halting/ExecuteA64
// Execute an A64 instruction in Debug state.
ExecuteA64(bits(32) instr);
shared/debug/halting/ExecuteT32
// Execute a T32 instruction in Debug state.
ExecuteT32(bits(16) hw1, bits(16) hw2);
shared/debug/halting/ExitDebugState
// ExitDebugState()
// ================
ExitDebugState()
assert Halted();
SynchronizeContext();
// Although EDSCR.STATUS signals that the PE is restarting, debuggers must use EDPRSR.SDR to
// detect that the PE has restarted.
EDSCR.STATUS = '000001'; // Signal restarting
EDESR<2:0> = '000'; // Clear any pending Halting debug events
bits(64) new_pc;
bits(64) spsr;
if UsingAArch32() then
new_pc = ZeroExtend(DLR);
spsr = ZeroExtend(DSPSR);
else
new_pc = DLR_EL0;
spsr = DSPSR_EL0;
// If this is an illegal return, SetPSTATEFromPSR() will set PSTATE.IL.
if UsingAArch32() then
SetPSTATEFromPSR(spsr<31:0>); // Can update privileged bits, even at EL0
else
SetPSTATEFromPSR(spsr); // Can update privileged bits, even at EL0
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-439
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
if UsingAArch32() then
if ConstrainUnpredictableBool() then new_pc<0> = '0';
// AArch32 branch
BranchTo(new_pc<31:0>, BranchType_DBGEXIT, branch_conditional);
else
// If targeting AArch32 then possibly zero the 32 most significant bits of the target PC
if spsr<4> == '1' && ConstrainUnpredictableBool() then
new_pc<63:32> = Zeros();
// A type of branch that is never predicted
BranchTo(new_pc, BranchType_DBGEXIT, branch_conditional);
return;
shared/debug/halting/Halt
// Halt()
// ======
Halt(bits(6) reason)
boolean is_async = FALSE;
Halt(reason, is_async);
// Halt()
// ======
if UsingAArch32() then
DLR = preferred_restart_address<31:0>;
DSPSR = spsr_32;
else
DLR_EL0 = preferred_restart_address;
DSPSR_EL0 = spsr_64;
EDSCR.ITE = '1';
EDSCR.ITO = '0';
if CurrentSecurityState() == SS_Secure then
EDSCR.SDD = '0'; // If entered in Secure state, allow debug
elsif HaveEL(EL3) then
EDSCR.SDD = if ExternalSecureInvasiveDebugEnabled() then '0' else '1';
else
EDSCR.SDD = '1'; // Otherwise EDSCR.SDD is RES1
EDSCR.MA = '0';
// In Debug state:
// * PSTATE.{SS,SSBS,D,A,I,F} are not observable and ignored so behave-as-if UNKNOWN.
// * PSTATE.{N,Z,C,V,Q,GE,E,M,nRW,EL,SP,DIT} are also not observable, but since these
// are not changed on exception entry, this function also leaves them unchanged.
// * PSTATE.{IT,T} are ignored.
// * PSTATE.IL is ignored and behave-as-if 0.
// * PSTATE.{UAO,PAN} are observable and not changed on entry into Debug state.
if UsingAArch32() then
I1-440 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
StopInstructionPrefetchAndEnableITR();
EDSCR.STATUS = reason; // Signal entered Debug state
UpdateEDSCRFields(); // Update EDSCR PE state flags.
return;
shared/debug/halting/HaltOnBreakpointOrWatchpoint
// HaltOnBreakpointOrWatchpoint()
// ==============================
// Returns TRUE if the Breakpoint and Watchpoint debug events should be considered for Debug
// state entry, FALSE if they should be considered for a debug exception.
boolean HaltOnBreakpointOrWatchpoint()
return HaltingAllowed() && EDSCR.HDE == '1' && OSLSR_EL1.OSLK == '0';
shared/debug/halting/Halted
// Halted()
// ========
boolean Halted()
return !(EDSCR.STATUS IN {'000001', '000010'}); // Halted
shared/debug/halting/HaltingAllowed
// HaltingAllowed()
// ================
// Returns TRUE if halting is currently allowed, FALSE if halting is prohibited.
boolean HaltingAllowed()
if Halted() || DoubleLockStatus() then
return FALSE;
ss = CurrentSecurityState();
case ss of
when SS_NonSecure return ExternalInvasiveDebugEnabled();
when SS_Secure return ExternalSecureInvasiveDebugEnabled();
shared/debug/halting/Restarting
// Restarting()
// ============
boolean Restarting()
return EDSCR.STATUS == '000001'; // Restarting
shared/debug/halting/StopInstructionPrefetchAndEnableITR
StopInstructionPrefetchAndEnableITR();
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-441
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/debug/halting/UpdateEDSCRFields
// UpdateEDSCRFields()
// ===================
// Update EDSCR PE state fields
UpdateEDSCRFields()
if !Halted() then
EDSCR.EL = '00';
EDSCR.NS = bit UNKNOWN;
EDSCR.RW = '1111';
else
EDSCR.EL = PSTATE.EL;
EDSCR.NS = '0';
EDSCR.RW = '1111';
return;
shared/debug/haltingevents/CheckExceptionCatch
// CheckExceptionCatch()
// =====================
// Check whether an Exception Catch debug event is set on the current Exception level
CheckExceptionCatch(boolean exception_entry)
// Called after an exception entry or exit, that is, such that the Security state
// and PSTATE.EL are correct for the exception target. When FEAT_Debugv8p2
// is not implemented, this function might also be called at any time.
ss = SecurityStateAtEL(PSTATE.EL);
base = if ss == SS_Secure then 0 else 4;
if HaltingAllowed() then
boolean halt;
if HaveExtendedECDebugEvents() then
exception_exit = !exception_entry;
increment = 8;
ctrl = EDECCR<UInt(PSTATE.EL) + base + increment>:EDECCR<UInt(PSTATE.EL) + base>;
case ctrl of
when '00' halt = FALSE;
when '01' halt = TRUE;
when '10' halt = (exception_exit == TRUE);
when '11' halt = (exception_entry == TRUE);
else
halt = (EDECCR<UInt(PSTATE.EL) + base> == '1');
if halt then
Halt(DebugHalt_ExceptionCatch);
shared/debug/haltingevents/CheckHaltingStep
// CheckHaltingStep()
// ==================
// Check whether EDESR.SS has been set by Halting Step
CheckHaltingStep(boolean is_async)
if HaltingAllowed() && EDESR.SS == '1' then
// The STATUS code depends on how we arrived at the state where EDESR.SS == 1.
if HaltingStep_DidNotStep() then
Halt(DebugHalt_Step_NoSyndrome, is_async);
elsif HaltingStep_SteppedEX() then
Halt(DebugHalt_Step_Exclusive, is_async);
else
Halt(DebugHalt_Step_Normal, is_async);
I1-442 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/debug/haltingevents/CheckOSUnlockCatch
// CheckOSUnlockCatch()
// ====================
// Called on unlocking the OS Lock to pend an OS Unlock Catch debug event
CheckOSUnlockCatch()
if HaveDoPD() && CTIDEVCTL.OSUCE == '1' then
if !Halted() then EDESR.OSUC = '1';
shared/debug/haltingevents/CheckPendingOSUnlockCatch
// CheckPendingOSUnlockCatch()
// ===========================
// Check whether EDESR.OSUC has been set by an OS Unlock Catch debug event
CheckPendingOSUnlockCatch()
if HaltingAllowed() && EDESR.OSUC == '1' then
boolean is_async = TRUE;
Halt(DebugHalt_OSUnlockCatch, is_async);
shared/debug/haltingevents/CheckPendingResetCatch
// CheckPendingResetCatch()
// ========================
// Check whether EDESR.RC has been set by a Reset Catch debug event
CheckPendingResetCatch()
if HaltingAllowed() && EDESR.RC == '1' then
boolean is_async = TRUE;
Halt(DebugHalt_ResetCatch, is_async);
shared/debug/haltingevents/CheckResetCatch
// CheckResetCatch()
// =================
// Called after reset
CheckResetCatch()
if (HaveDoPD() && CTIDEVCTL.RCE == '1') then
EDESR.RC = '1';
// If halting is allowed then halt immediately
if HaltingAllowed() then Halt(DebugHalt_ResetCatch);
shared/debug/haltingevents/CheckSoftwareAccessToDebugRegisters
// CheckSoftwareAccessToDebugRegisters()
// =====================================
// Check for access to Breakpoint and Watchpoint registers.
CheckSoftwareAccessToDebugRegisters()
os_lock = (if ELUsingAArch32(EL1) then DBGOSLSR.OSLK else OSLSR_EL1.OSLK);
if HaltingAllowed() && EDSCR.TDA == '1' && os_lock == '0' then
Halt(DebugHalt_SoftwareAccess);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-443
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/debug/haltingevents/ExternalDebugRequest
// ExternalDebugRequest()
// ======================
ExternalDebugRequest()
if HaltingAllowed() then
boolean is_async = TRUE;
Halt(DebugHalt_EDBGRQ, is_async);
// Otherwise the CTI continues to assert the debug request until it is taken.
shared/debug/haltingevents/HaltingStep_DidNotStep
// Returns TRUE if the previously executed instruction was executed in the inactive state, that is,
// if it was not itself stepped.
boolean HaltingStep_DidNotStep();
shared/debug/haltingevents/HaltingStep_SteppedEX
// Returns TRUE if the previously executed instruction was a Load-Exclusive class instruction
// executed in the active-not-pending state.
boolean HaltingStep_SteppedEX();
shared/debug/haltingevents/RunHaltingStep
// RunHaltingStep()
// ================
if active && reset then // Coming out of reset with EDECR.SS set
EDESR.SS = '1';
elsif active && HaltingAllowed() then
boolean advance;
if exception_generated && exception_target == EL3 then
advance = syscall || ExternalSecureInvasiveDebugEnabled();
else
advance = TRUE;
if advance then EDESR.SS = '1';
return;
shared/debug/interrupts/ExternalDebugInterruptsDisabled
// ExternalDebugInterruptsDisabled()
// =================================
// Determine whether EDSCR disables interrupts routed to 'target'.
I1-444 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
boolean int_dis;
SecurityState ss = SecurityStateAtEL(target);
if Havev8p4Debug() then
if EDSCR.INTdis[0] == '1' then
case ss of
when SS_NonSecure int_dis = ExternalInvasiveDebugEnabled();
when SS_Secure int_dis = ExternalSecureInvasiveDebugEnabled();
else
int_dis = FALSE;
else
case target of
when EL3
int_dis = (EDSCR.INTdis == '11' && ExternalSecureInvasiveDebugEnabled());
when EL2
int_dis = (EDSCR.INTdis IN {'1x'} && ExternalInvasiveDebugEnabled());
when EL1
if ss == SS_Secure then
int_dis = (EDSCR.INTdis IN {'1x'} && ExternalSecureInvasiveDebugEnabled());
else
int_dis = (EDSCR.INTdis != '00' && ExternalInvasiveDebugEnabled());
return int_dis;
shared/debug/pmu/GetNumEventCounters
// GetNumEventCounters()
// =====================
// Returns the number of event counters implemented. This is indicated to software at the
// highest Exception level by PMCR.N in AArch32 state, and PMCR_EL0.N in AArch64 state.
integer GetNumEventCounters()
return integer IMPLEMENTATION_DEFINED "Number of event counters";
shared/debug/pmu/HasElapsed64Cycles
// Returns TRUE if 64 cycles have elapsed between the last count, and FALSE otherwise.
boolean HasElapsed64Cycles();
shared/debug/pmu/PMUCounterMask
constant integer CYCLE_COUNTER_ID = 31;
// PMUCounterMask()
// ================
// Return bitmask of accessible PMU counters.
bits(32) PMUCounterMask()
integer n;
if UsingAArch32() then
n = AArch32.GetNumEventCountersAccessible();
else
n = AArch64.GetNumEventCountersAccessible();
return '1' : ZeroExtend(Ones(n), 31);
shared/debug/pmu/PMUEvent
// PMUEvent()
// ==========
// Generate a PMU event. By default, increment by 1.
PMUEvent(bits(16) event)
PMUEvent(event, 1);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-445
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// PMUEvent()
// ==========
// Accumulate a PMU Event.
// PMUEvent()
// ==========
// Accumulate a PMU Event for a specific event counter.
if UsingAArch32() then
if PMEVTYPER[idx].evtCount == event then
PMUEventAccumulator[idx] = PMUEventAccumulator[idx] + increment;
else
if PMEVTYPER_EL0[idx].evtCount == event then
PMUEventAccumulator[idx] = PMUEventAccumulator[idx] + increment;
shared/debug/pmu/integer
array integer PMUEventAccumulator[0..30]; // Accumulates PMU events for a cycle
shared/debug/samplebasedprofiling/CreatePCSample
// CreatePCSample()
// ================
CreatePCSample()
// In a simple sequential execution of the program, CreatePCSample is executed each time the PE
// executes an instruction that can be sampled. An implementation is not constrained such that
// reads of EDPCSRlo return the current values of PC, etc.
if pc_sample.has_el2 then
if !Have16bitVMID() || VTCR_EL2.VS == '0' then
pc_sample.vmid = ZeroExtend(VSCTLR_EL2.VMID<7:0>, 16);
else
pc_sample.vmid = VSCTLR_EL2.VMID;
pc_sample.contextidr_el2 = CONTEXTIDR_EL2<31:0>;
pc_sample.el0h = FALSE;
return;
shared/debug/samplebasedprofiling/PCSample
type PCSample is (
boolean valid,
bits(64) pc,
I1-446 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
bits(2) el,
bit rw,
SecurityState ss,
boolean has_el2,
bits(32) contextidr,
bits(32) contextidr_el2,
boolean el0h,
bits(16) vmid
)
PCSample pc_sample;
shared/debug/samplebasedprofiling/PMPCSR
// PMPCSR[] (read)
// ===============
bits(32) sample;
if pc_sample.valid then
sample = pc_sample.pc<31:0>;
if update then
PMPCSR<55:32> = (if pc_sample.rw == '0' then Zeros(24) else pc_sample.pc<55:32>);
PMPCSR.EL = pc_sample.el;
PMPCSR.NS = (if pc_sample.ss == SS_Secure then '0' else '1');
PMCID1SR = pc_sample.contextidr;
PMCID2SR = if pc_sample.has_el2 then pc_sample.contextidr_el2 else bits(32) UNKNOWN;
return sample;
shared/debug/softwarestep/CheckSoftwareStep
// CheckSoftwareStep()
// ===================
// Take a Software Step exception if in the active-pending state
CheckSoftwareStep()
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-447
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
== '1';
if step_enabled && PSTATE.SS == '0' then
AArch64.SoftwareStepException();
shared/debug/softwarestep/DebugExceptionReturnSS
// DebugExceptionReturnSS()
// ========================
// Returns value to write to PSTATE.SS on an exception return or Debug state exit.
boolean enabled_at_source;
if Restarting() then
enabled_at_source = FALSE;
elsif UsingAArch32() then
enabled_at_source = AArch32.GenerateDebugExceptions();
else
enabled_at_source = AArch64.GenerateDebugExceptions();
boolean valid;
bits(2) dest_el;
if IllegalExceptionReturn(spsr) then
dest_el = PSTATE.EL;
else
(valid, dest_el) = ELFromSPSR(spsr); assert valid;
dest_ss = SecurityStateAtEL(dest_el);
bit mask;
boolean enabled_at_dest;
dest_using_32 = (if dest_el == EL0 then spsr<4> == '1' else ELUsingAArch32(dest_el));
if dest_using_32 then
enabled_at_dest = AArch32.GenerateDebugExceptionsFrom(dest_el, dest_ss);
else
mask = spsr<9>;
enabled_at_dest = AArch64.GenerateDebugExceptionsFrom(dest_el, dest_ss, mask);
ELd = DebugTargetFrom(dest_ss);
bit SS_bit;
if !ELUsingAArch32(ELd) && MDSCR_EL1.SS == '1' && !enabled_at_source && enabled_at_dest then
SS_bit = spsr<21>;
else
SS_bit = '0';
return SS_bit;
shared/debug/softwarestep/SSAdvance
// SSAdvance()
// ===========
// Advance the Software Step state machine.
SSAdvance()
// A simpler implementation of this function just clears PSTATE.SS to zero regardless of the
// current Software Step state machine. However, this check is made to illustrate that the
// processor only needs to consider advancing the state machine from the active-not-pending
// state.
I1-448 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
target = DebugTarget();
step_enabled = !ELUsingAArch32(target) && MDSCR_EL1.SS == '1';
active_not_pending = step_enabled && PSTATE.SS == '1';
return;
shared/debug/softwarestep/SoftwareStep_DidNotStep
// Returns TRUE if the previously executed instruction was executed in the
// inactive state, that is, if it was not itself stepped.
// Might return TRUE or FALSE if the previously executed instruction was an ISB
// or ERET executed in the active-not-pending state, or if another exception
// was taken before the Software Step exception. Returns FALSE otherwise,
// indicating that the previously executed instruction was executed in the
// active-not-pending state, that is, the instruction was stepped.
boolean SoftwareStep_DidNotStep();
shared/debug/softwarestep/SoftwareStep_SteppedEX
// Returns a value that describes the previously executed instruction. The
// result is valid only if SoftwareStep_DidNotStep() returns FALSE.
// Returns TRUE if the instruction was a Load-Exclusive class instruction,
// and FALSE if the instruction was not a Load-Exclusive class instruction.
boolean SoftwareStep_SteppedEX();
I1.2.2 shared/exceptions
This section includes the following pseudocode functions:
• shared/exceptions/exceptions/ConditionSyndrome.
• shared/exceptions/exceptions/Exception on page I1-450.
• shared/exceptions/exceptions/ExceptionRecord on page I1-450.
• shared/exceptions/exceptions/ExceptionSyndrome on page I1-451.
shared/exceptions/exceptions/ConditionSyndrome
// ConditionSyndrome()
// ===================
// Return CV and COND fields of instruction syndrome
bits(5) ConditionSyndrome()
bits(5) syndrome;
if UsingAArch32() then
cond = AArch32.CurrentCond();
if PSTATE.T == '0' then // A32
syndrome<4> = '1';
// A conditional A32 instruction that is known to pass its condition code check
// can be presented either with COND set to 0xE, the value for unconditional, or
// the COND value held in the instruction.
if ConditionHolds(cond) && ConstrainUnpredictableBool() then
syndrome<3:0> = '1110';
else
syndrome<3:0> = cond;
else // T32
// When a T32 instruction is trapped, it is IMPLEMENTATION DEFINED whether:
// * CV set to 0 and COND is set to an UNKNOWN value
// * CV set to 1 and COND is set to the condition code for the condition that
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-449
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return syndrome;
shared/exceptions/exceptions/Exception
enumeration Exception {Exception_Uncategorized, // Uncategorized or unknown reason
Exception_WFxTrap, // Trapped WFI or WFE instruction
Exception_CP15RTTrap, // Trapped AArch32 MCR or MRC access,
coproc=0b1111
Exception_CP15RRTTrap, // Trapped AArch32 MCRR or MRRC access,
coproc=0b1111
Exception_CP14RTTrap, // Trapped AArch32 MCR or MRC access,
coproc=0b1110
Exception_CP14DTTrap, // Trapped AArch32 LDC or STC access,
coproc=0b1110
Exception_CP14RRTTrap, // Trapped AArch32 MRRC access, coproc=0b1110
Exception_AdvSIMDFPAccessTrap, // HCPTR-trapped access to SIMD or FP
Exception_FPIDTrap, // Trapped access to SIMD or FP ID register
Exception_LDST64BTrap, // Trapped access to ST64B and LD64B
// Trapped BXJ instruction not supported in Armv8
Exception_PACTrap, // Trapped invalid PAC use
Exception_IllegalState, // Illegal Execution state
Exception_SupervisorCall, // Supervisor Call
Exception_HypervisorCall, // Hypervisor Call
Exception_MonitorCall, // Monitor Call or Trapped SMC instruction
Exception_SystemRegisterTrap, // Trapped MRS or MSR system register access
Exception_InstructionAbort, // Instruction Abort or Prefetch Abort
Exception_PCAlignment, // PC alignment fault
Exception_DataAbort, // Data Abort
Exception_PACFail, // PAC Authentication failure
Exception_SPAlignment, // SP alignment fault
Exception_FPTrappedException, // IEEE trapped FP exception
Exception_SError, // SError interrupt
Exception_Breakpoint, // (Hardware) Breakpoint
Exception_SoftwareStep, // Software Step
Exception_Watchpoint, // Watchpoint
Exception_SoftwareBreakpoint, // Software Breakpoint Instruction
Exception_VectorCatch, // AArch32 Vector Catch
Exception_IRQ, // IRQ interrupt
Exception_FIQ}; // FIQ interrupt
shared/exceptions/exceptions/ExceptionRecord
type ExceptionRecord is (
Exception exceptype, // Exception class
bits(25) syndrome, // Syndrome record
bits(64) vaddress, // Virtual fault address
boolean ipavalid, // Validity of Intermediate Physical fault address
bit NS, // Intermediate Physical fault address space
bits(52) ipaddress, // Intermediate Physical fault address
boolean trappedsyscallinst) // Trapped SVC or SMC instruction
I1-450 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/exceptions/exceptions/ExceptionSyndrome
// ExceptionSyndrome()
// ===================
// Return a blank exception syndrome record for an exception of the given type.
ExceptionRecord r;
r.exceptype = exceptype;
I1.2.3 shared/functions
This section includes the following pseudocode functions:
• shared/functions/aborts/EncodeLDFSC on page I1-458.
• shared/functions/aborts/IPAValid on page I1-459.
• shared/functions/aborts/IsAsyncAbort on page I1-459.
• shared/functions/aborts/IsDebugException on page I1-459.
• shared/functions/aborts/IsExternalAbort on page I1-460.
• shared/functions/aborts/IsExternalSyncAbort on page I1-460.
• shared/functions/aborts/IsFault on page I1-460.
• shared/functions/aborts/IsSErrorInterrupt on page I1-461.
• shared/functions/aborts/IsSecondStage on page I1-461.
• shared/functions/aborts/LSInstructionSyndrome on page I1-461.
• shared/functions/cache/CACHE_OP on page I1-461.
• shared/functions/cache/CPASAtPAS on page I1-461.
• shared/functions/cache/CPASAtSecurityState on page I1-462.
• shared/functions/cache/CacheOp on page I1-462.
• shared/functions/cache/CacheOpScope on page I1-462.
• shared/functions/cache/CachePASpace on page I1-462.
• shared/functions/cache/CacheRecord on page I1-462.
• shared/functions/cache/CacheType on page I1-463.
• shared/functions/cache/DCInstNeedsTranslation on page I1-463.
• shared/functions/cache/DecodeSW on page I1-463.
• shared/functions/cache/GetCacheInfo on page I1-463.
• shared/functions/cache/ICInstNeedsTranslation on page I1-464.
• shared/functions/common/ASR on page I1-464.
• shared/functions/common/ASR_C on page I1-464.
• shared/functions/common/Abs on page I1-464.
• shared/functions/common/Align on page I1-464.
• shared/functions/common/BitCount on page I1-465.
• shared/functions/common/CountLeadingSignBits on page I1-465.
• shared/functions/common/CountLeadingZeroBits on page I1-465.
• shared/functions/common/Elem on page I1-465.
• shared/functions/common/Extend on page I1-466.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-451
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
I1-452 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-453
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
I1-454 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-455
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
I1-456 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-457
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/aborts/EncodeLDFSC
// EncodeLDFSC()
// =============
// Function that gives the Long-descriptor FSC code for types of Fault
case statuscode of
when Fault_AddressSize result = '0000':level<1:0>; assert level IN {0,1,2,3};
when Fault_AccessFlag result = '0010':level<1:0>; assert level IN {1,2,3};
when Fault_Permission result = '0011':level<1:0>; assert level IN {0,1,2,3};
when Fault_Translation result = '0001':level<1:0>; assert level IN {0,1,2,3};
when Fault_SyncExternal result = '010000';
when Fault_SyncExternalOnWalk result = '0101':level<1:0>; assert level IN {0,1,2,3};
when Fault_SyncParity result = '011000';
when Fault_SyncParityOnWalk result = '0111':level<1:0>; assert level IN {0,1,2,3};
when Fault_AsyncParity result = '011001';
I1-458 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return result;
shared/functions/aborts/IPAValid
// IPAValid()
// ==========
// Return TRUE if the IPA is reported for the abort
if fault.s2fs1walk then
return fault.statuscode IN {
Fault_AccessFlag,
Fault_Permission,
Fault_Translation,
Fault_AddressSize
};
elsif fault.secondstage then
return fault.statuscode IN {
Fault_AccessFlag,
Fault_Translation,
Fault_AddressSize
};
else
return FALSE;
shared/functions/aborts/IsAsyncAbort
// IsAsyncAbort()
// ==============
// Returns TRUE if the abort currently being processed is an asynchronous abort, and FALSE
// otherwise.
// IsAsyncAbort()
// ==============
shared/functions/aborts/IsDebugException
// IsDebugException()
// ==================
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-459
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/aborts/IsExternalAbort
// IsExternalAbort()
// =================
// Returns TRUE if the abort currently being processed is an External abort and FALSE otherwise.
return (statuscode IN {
Fault_SyncExternal,
Fault_SyncParity,
Fault_SyncExternalOnWalk,
Fault_SyncParityOnWalk,
Fault_AsyncExternal,
Fault_AsyncParity
});
// IsExternalAbort()
// =================
shared/functions/aborts/IsExternalSyncAbort
// IsExternalSyncAbort()
// =====================
// Returns TRUE if the abort currently being processed is an external
// synchronous abort and FALSE otherwise.
return (statuscode IN {
Fault_SyncExternal,
Fault_SyncParity,
Fault_SyncExternalOnWalk,
Fault_SyncParityOnWalk
});
// IsExternalSyncAbort()
// =====================
shared/functions/aborts/IsFault
// IsFault()
// =========
// Return TRUE if a fault is associated with an address descriptor
// IsFault()
// =========
// Return TRUE if a fault is associated with a memory access.
// IsFault()
I1-460 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// =========
// Return TRUE if a fault is associated with status returned by memory.
shared/functions/aborts/IsSErrorInterrupt
// IsSErrorInterrupt()
// ===================
// Returns TRUE if the abort currently being processed is an SError interrupt, and FALSE
// otherwise.
// IsSErrorInterrupt()
// ===================
shared/functions/aborts/IsSecondStage
// IsSecondStage()
// ===============
return fault.secondstage;
shared/functions/aborts/LSInstructionSyndrome
// Returns the extended syndrome information for a second stage fault.
// <10> - Syndrome valid bit. The syndrome is valid only for certain types of access instruction.
// <9:8> - Access size.
// <7> - Sign extended (for loads).
// <6:2> - Transfer register.
// <1> - Transfer register is 64-bit.
// <0> - Instruction has acquire/release semantics.
bits(11) LSInstructionSyndrome();
shared/functions/cache/CACHE_OP
// CACHE_OP()
// ==========
// Performs Cache maintenance operations as per CacheRecord.
CACHE_OP(CacheRecord cache)
IMPLEMENTATION_DEFINED;
shared/functions/cache/CPASAtPAS
// CPASAtPAS()
// ===========
// Get cache PA space for given PA space.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-461
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/cache/CPASAtSecurityState
// CPASAtSecurityState()
// =====================
// Get cache PA space for given security state.
shared/functions/cache/CacheOp
enumeration CacheOp {
CacheOp_Clean,
CacheOp_Invalidate,
CacheOp_CleanInvalidate
};
shared/functions/cache/CacheOpScope
enumeration CacheOpScope {
CacheOpScope_SetWay,
CacheOpScope_PoU,
CacheOpScope_PoC,
CacheOpScope_PoP,
CacheOpScope_PoDP,
CacheOpScope_ALLU,
CacheOpScope_ALLUIS
};
shared/functions/cache/CachePASpace
enumeration CachePASpace {
CPAS_NonSecure,
CPAS_SecureNonSecure, // match entries from Secure or Non-Secure PAS
CPAS_Secure
};
shared/functions/cache/CacheRecord
type CacheRecord is (
AccType acctype, // Access type
CacheOp cacheop, // Cache operation
CacheOpScope opscope, // Cache operation type
CacheType cachetype, // Cache type
bits(64) regval,
FullAddress paddress,
bits(64) vaddress, // For VA operations
I1-462 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/cache/CacheType
enumeration CacheType {
CacheType_Data,
CacheType_Instruction
};
shared/functions/cache/DCInstNeedsTranslation
// DCInstNeedsTranslation()
// ========================
// Check whether Data Cache operation needs translation.
return TRUE;
shared/functions/cache/DecodeSW
// DecodeSW()
// ==========
// Decode input value into set, way and level for SW instructions.
shared/functions/cache/GetCacheInfo
// Returns numsets, assosciativity & linesize.
(integer, integer, integer) GetCacheInfo(integer level, CacheType cachetype);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-463
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/cache/ICInstNeedsTranslation
// ICInstNeedsTranslation()
// ========================
// Check whether Instruction Cache operation needs translation.
shared/functions/common/ASR
// ASR()
// =====
shared/functions/common/ASR_C
// ASR_C()
// =======
shared/functions/common/Abs
// Abs()
// =====
integer Abs(integer x)
return if x >= 0 then x else -x;
// Abs()
// =====
real Abs(real x)
return if x >= 0.0 then x else -x;
shared/functions/common/Align
// Align()
// =======
// Align()
// =======
I1-464 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/common/BitCount
// BitCount()
// ==========
integer BitCount(bits(N) x)
integer result = 0;
for i = 0 to N-1
if x<i> == '1' then
result = result + 1;
return result;
shared/functions/common/CountLeadingSignBits
// CountLeadingSignBits()
// ======================
integer CountLeadingSignBits(bits(N) x)
return CountLeadingZeroBits(x<N-1:1> EOR x<N-2:0>);
shared/functions/common/CountLeadingZeroBits
// CountLeadingZeroBits()
// ======================
integer CountLeadingZeroBits(bits(N) x)
return N - (HighestSetBit(x) + 1);
shared/functions/common/Elem
// Elem[] - non-assignment form
// ============================
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-465
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/common/Extend
// Extend()
// ========
// Extend()
// ========
shared/functions/common/HighestSetBit
// HighestSetBit()
// ===============
integer HighestSetBit(bits(N) x)
for i = N-1 downto 0
if x<i> == '1' then return i;
return -1;
shared/functions/common/Int
// Int()
// =====
shared/functions/common/IsOnes
// IsOnes()
// ========
boolean IsOnes(bits(N) x)
return x == Ones(N);
shared/functions/common/IsZero
// IsZero()
// ========
boolean IsZero(bits(N) x)
return x == Zeros(N);
shared/functions/common/IsZeroBit
// IsZeroBit()
// ===========
bit IsZeroBit(bits(N) x)
return if IsZero(x) then '1' else '0';
I1-466 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/common/LSL
// LSL()
// =====
shared/functions/common/LSL_C
// LSL_C()
// =======
shared/functions/common/LSR
// LSR()
// =====
shared/functions/common/LSR_C
// LSR_C()
// =======
shared/functions/common/LowestSetBit
// LowestSetBit()
// ==============
integer LowestSetBit(bits(N) x)
for i = 0 to N-1
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-467
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/common/Max
// Max()
// =====
// Max()
// =====
shared/functions/common/Min
// Min()
// =====
// Min()
// =====
shared/functions/common/Ones
// Ones()
// ======
bits(N) Ones(integer N)
return Replicate('1',N);
// Ones()
// ======
bits(N) Ones()
return Ones(N);
shared/functions/common/ROR
// ROR()
// =====
I1-468 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/common/ROR_C
// ROR_C()
// =======
shared/functions/common/Replicate
// Replicate()
// ===========
bits(N) Replicate(bits(M) x)
assert N MOD M == 0;
return Replicate(x, N DIV M);
shared/functions/common/RoundDown
integer RoundDown(real x);
shared/functions/common/RoundTowardsZero
// RoundTowardsZero()
// ==================
integer RoundTowardsZero(real x)
return if x == 0.0 then 0 else if x >= 0.0 then RoundDown(x) else RoundUp(x);
shared/functions/common/RoundUp
integer RoundUp(real x);
shared/functions/common/SInt
// SInt()
// ======
integer SInt(bits(N) x)
result = 0;
for i = 0 to N-1
if x<i> == '1' then result = result + 2^i;
if x<N-1> == '1' then result = result - 2^N;
return result;
shared/functions/common/SignExtend
// SignExtend()
// ============
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-469
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
assert N >= M;
return Replicate(x<M-1>, N-M) : x;
// SignExtend()
// ============
bits(N) SignExtend(bits(M) x)
return SignExtend(x, N);
shared/functions/common/Split64to32
// Split64to32()
// =============
shared/functions/common/UInt
// UInt()
// ======
integer UInt(bits(N) x)
result = 0;
for i = 0 to N-1
if x<i> == '1' then result = result + 2^i;
return result;
shared/functions/common/ZeroExtend
// ZeroExtend()
// ============
// ZeroExtend()
// ============
bits(N) ZeroExtend(bits(M) x)
return ZeroExtend(x, N);
shared/functions/common/Zeros
// Zeros()
// =======
bits(N) Zeros(integer N)
return Replicate('0',N);
// Zeros()
// =======
bits(N) Zeros()
return Zeros(N);
I1-470 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/counters/AArch32.CheckTimerConditions
// AArch32.CheckTimerConditions()
// ==============================
// Checking timer conditions for all A32 timer registers
AArch32.CheckTimerConditions()
boolean status;
bits(64) offset;
offset = Zeros(64);
assert !HaveAArch64();
if HaveEL(EL3) then
if CNTP_CTL_S.ENABLE == '1' then
status = IsTimerConditionMet(offset, CNTP_CVAL_S,
CNTP_CTL_S.IMASK, InterruptID_CNTPS);
CNTP_CTL_S.ISTATUS = if status then '1' else '0';
return;
shared/functions/counters/AArch64.CheckTimerConditions
// AArch64.CheckTimerConditions()
// ==============================
// Checking timer conditions for all A64 timer registers
AArch64.CheckTimerConditions()
boolean status;
bits(64) offset;
bit imask;
offset = Zeros(64);
if CNTP_CTL_EL0.ENABLE == '1' then
imask = CNTP_CTL_EL0.IMASK;
status = IsTimerConditionMet(offset, CNTP_CVAL_EL0,
imask, InterruptID_CNTP);
CNTP_CTL_EL0.ISTATUS = if status then '1' else '0';
if HaveEL(EL2) && HaveSecureEL2Ext() && CNTHPS_CTL_EL2.ENABLE == '1' then
status = IsTimerConditionMet(Zeros(64), CNTHPS_CVAL_EL2,
CNTHPS_CTL_EL2.IMASK, InterruptID_CNTHPS);
CNTHPS_CTL_EL2.ISTATUS = if status then '1' else '0';
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-471
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return;
shared/functions/counters/GenericCounterTick
// GenericCounterTick()
// ====================
// Increments PhysicalCount value for every clock tick.
GenericCounterTick()
bits(64) prev_physical_count;
if CNTCR.EN == '0' then
if !HaveAArch64() then
AArch32.CheckTimerConditions();
else
AArch64.CheckTimerConditions();
return;
prev_physical_count = PhysicalCountInt();
PhysicalCount<63:0> = PhysicalCount<63:0> + 1;
if !HaveAArch64() then
AArch32.CheckTimerConditions();
else
AArch64.CheckTimerConditions();
TestEventCNTP(prev_physical_count, PhysicalCountInt());
TestEventCNTV(prev_physical_count, PhysicalCountInt());
return;
shared/functions/counters/IsTimerConditionMet
// IsTimerConditionMet()
// =====================
shared/functions/counters/PhysicalCount
bits(64) PhysicalCount;
shared/functions/counters/SetEventRegister
// SetEventRegister()
// ==================
// Sets the Event Register of this PE
SetEventRegister()
EventRegister = '1';
return;
I1-472 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/counters/TestEventCNTP
// TestEventCNTP()
// ===============
// Generate Event stream from the physical counter
shared/functions/counters/TestEventCNTV
// TestEventCNTV()
// ===============
// Generate Event stream from the virtual counter
shared/functions/crc/BitReverse
// BitReverse()
// ============
shared/functions/crc/HaveCRCExt
// HaveCRCExt()
// ============
boolean HaveCRCExt()
return HasArchVersion(ARMv8p1) || boolean IMPLEMENTATION_DEFINED "Have CRC extension";
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-473
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/crc/Poly32Mod2
// Poly32Mod2()
// ============
shared/functions/crypto/AESInvMixColumns
// AESInvMixColumns()
// ==================
// Transformation in the Inverse Cipher that is the inverse of AESMixColumns.
bits(4*8) out0;
bits(4*8) out1;
bits(4*8) out2;
bits(4*8) out3;
for c = 0 to 3
out0<c*8+:8> = FFmul0E(in0<c*8+:8>) EOR FFmul0B(in1<c*8+:8>) EOR FFmul0D(in2<c*8+:8>) EOR
FFmul09(in3<c*8+:8>);
out1<c*8+:8> = FFmul09(in0<c*8+:8>) EOR FFmul0E(in1<c*8+:8>) EOR FFmul0B(in2<c*8+:8>) EOR
FFmul0D(in3<c*8+:8>);
out2<c*8+:8> = FFmul0D(in0<c*8+:8>) EOR FFmul09(in1<c*8+:8>) EOR FFmul0E(in2<c*8+:8>) EOR
FFmul0B(in3<c*8+:8>);
out3<c*8+:8> = FFmul0B(in0<c*8+:8>) EOR FFmul0D(in1<c*8+:8>) EOR FFmul09(in2<c*8+:8>) EOR
FFmul0E(in3<c*8+:8>);
return (
out3<3*8+:8> : out2<3*8+:8> : out1<3*8+:8> : out0<3*8+:8> :
out3<2*8+:8> : out2<2*8+:8> : out1<2*8+:8> : out0<2*8+:8> :
out3<1*8+:8> : out2<1*8+:8> : out1<1*8+:8> : out0<1*8+:8> :
out3<0*8+:8> : out2<0*8+:8> : out1<0*8+:8> : out0<0*8+:8>
);
shared/functions/crypto/AESInvShiftRows
// AESInvShiftRows()
// =================
// Transformation in the Inverse Cipher that is inverse of AESShiftRows.
I1-474 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/crypto/AESInvSubBytes
// AESInvSubBytes()
// ================
// Transformation in the Inverse Cipher that is the inverse of AESSubBytes.
shared/functions/crypto/AESMixColumns
// AESMixColumns()
// ===============
// Transformation in the Cipher that takes all of the columns of the
// State and mixes their data (independently of one another) to
// produce new columns.
bits(4*8) out0;
bits(4*8) out1;
bits(4*8) out2;
bits(4*8) out3;
for c = 0 to 3
out0<c*8+:8> = FFmul02(in0<c*8+:8>) EOR FFmul03(in1<c*8+:8>) EOR in2<c*8+:8> EOR
in3<c*8+:8>;
out1<c*8+:8> = in0<c*8+:8> EOR FFmul02(in1<c*8+:8>) EOR FFmul03(in2<c*8+:8>) EOR
in3<c*8+:8>;
out2<c*8+:8> = in0<c*8+:8> EOR in1<c*8+:8> EOR FFmul02(in2<c*8+:8>) EOR
FFmul03(in3<c*8+:8>);
out3<c*8+:8> = FFmul03(in0<c*8+:8>) EOR in1<c*8+:8> EOR in2<c*8+:8> EOR
FFmul02(in3<c*8+:8>);
return (
out3<3*8+:8> : out2<3*8+:8> : out1<3*8+:8> : out0<3*8+:8> :
out3<2*8+:8> : out2<2*8+:8> : out1<2*8+:8> : out0<2*8+:8> :
out3<1*8+:8> : out2<1*8+:8> : out1<1*8+:8> : out0<1*8+:8> :
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-475
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/crypto/AESShiftRows
// AESShiftRows()
// ==============
// Transformation in the Cipher that processes the State by cyclically
// shifting the last three rows of the State by different offsets.
shared/functions/crypto/AESSubBytes
// AESSubBytes()
// =============
// Transformation in the Cipher that processes the State using a nonlinear
// byte substitution table (S-box) that operates on each of the State bytes
// independently.
shared/functions/crypto/FFmul02
// FFmul02()
// =========
bits(8) FFmul02(bits(8) b)
bits(256*8) FFmul_02 = (
/* F E D C B A 9 8 7 6 5 4 3 2 1 0 */
/*F*/ 0xE5E7E1E3EDEFE9EBF5F7F1F3FDFFF9FB<127:0> :
/*E*/ 0xC5C7C1C3CDCFC9CBD5D7D1D3DDDFD9DB<127:0> :
/*D*/ 0xA5A7A1A3ADAFA9ABB5B7B1B3BDBFB9BB<127:0> :
I1-476 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
/*C*/ 0x858781838D8F898B959791939D9F999B<127:0> :
/*B*/ 0x656761636D6F696B757771737D7F797B<127:0> :
/*A*/ 0x454741434D4F494B555751535D5F595B<127:0> :
/*9*/ 0x252721232D2F292B353731333D3F393B<127:0> :
/*8*/ 0x050701030D0F090B151711131D1F191B<127:0> :
/*7*/ 0xFEFCFAF8F6F4F2F0EEECEAE8E6E4E2E0<127:0> :
/*6*/ 0xDEDCDAD8D6D4D2D0CECCCAC8C6C4C2C0<127:0> :
/*5*/ 0xBEBCBAB8B6B4B2B0AEACAAA8A6A4A2A0<127:0> :
/*4*/ 0x9E9C9A98969492908E8C8A8886848280<127:0> :
/*3*/ 0x7E7C7A78767472706E6C6A6866646260<127:0> :
/*2*/ 0x5E5C5A58565452504E4C4A4846444240<127:0> :
/*1*/ 0x3E3C3A38363432302E2C2A2826242220<127:0> :
/*0*/ 0x1E1C1A18161412100E0C0A0806040200<127:0>
);
return FFmul_02<UInt(b)*8+:8>;
shared/functions/crypto/FFmul03
// FFmul03()
// =========
bits(8) FFmul03(bits(8) b)
bits(256*8) FFmul_03 = (
/* F E D C B A 9 8 7 6 5 4 3 2 1 0 */
/*F*/ 0x1A191C1F16151013020104070E0D080B<127:0> :
/*E*/ 0x2A292C2F26252023323134373E3D383B<127:0> :
/*D*/ 0x7A797C7F76757073626164676E6D686B<127:0> :
/*C*/ 0x4A494C4F46454043525154575E5D585B<127:0> :
/*B*/ 0xDAD9DCDFD6D5D0D3C2C1C4C7CECDC8CB<127:0> :
/*A*/ 0xEAE9ECEFE6E5E0E3F2F1F4F7FEFDF8FB<127:0> :
/*9*/ 0xBAB9BCBFB6B5B0B3A2A1A4A7AEADA8AB<127:0> :
/*8*/ 0x8A898C8F86858083929194979E9D989B<127:0> :
/*7*/ 0x818287848D8E8B88999A9F9C95969390<127:0> :
/*6*/ 0xB1B2B7B4BDBEBBB8A9AAAFACA5A6A3A0<127:0> :
/*5*/ 0xE1E2E7E4EDEEEBE8F9FAFFFCF5F6F3F0<127:0> :
/*4*/ 0xD1D2D7D4DDDEDBD8C9CACFCCC5C6C3C0<127:0> :
/*3*/ 0x414247444D4E4B48595A5F5C55565350<127:0> :
/*2*/ 0x717277747D7E7B78696A6F6C65666360<127:0> :
/*1*/ 0x212227242D2E2B28393A3F3C35363330<127:0> :
/*0*/ 0x111217141D1E1B18090A0F0C05060300<127:0>
);
return FFmul_03<UInt(b)*8+:8>;
shared/functions/crypto/FFmul09
// FFmul09()
// =========
bits(8) FFmul09(bits(8) b)
bits(256*8) FFmul_09 = (
/* F E D C B A 9 8 7 6 5 4 3 2 1 0 */
/*F*/ 0x464F545D626B70790E071C152A233831<127:0> :
/*E*/ 0xD6DFC4CDF2FBE0E99E978C85BAB3A8A1<127:0> :
/*D*/ 0x7D746F6659504B42353C272E1118030A<127:0> :
/*C*/ 0xEDE4FFF6C9C0DBD2A5ACB7BE8188939A<127:0> :
/*B*/ 0x3039222B141D060F78716A635C554E47<127:0> :
/*A*/ 0xA0A9B2BB848D969FE8E1FAF3CCC5DED7<127:0> :
/*9*/ 0x0B0219102F263D34434A5158676E757C<127:0> :
/*8*/ 0x9B928980BFB6ADA4D3DAC1C8F7FEE5EC<127:0> :
/*7*/ 0xAAA3B8B18E879C95E2EBF0F9C6CFD4DD<127:0> :
/*6*/ 0x3A3328211E170C05727B6069565F444D<127:0> :
/*5*/ 0x9198838AB5BCA7AED9D0CBC2FDF4EFE6<127:0> :
/*4*/ 0x0108131A252C373E49405B526D647F76<127:0> :
/*3*/ 0xDCD5CEC7F8F1EAE3949D868FB0B9A2AB<127:0> :
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-477
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
/*2*/ 0x4C455E5768617A73040D161F2029323B<127:0> :
/*1*/ 0xE7EEF5FCC3CAD1D8AFA6BDB48B829990<127:0> :
/*0*/ 0x777E656C535A41483F362D241B120900<127:0>
);
return FFmul_09<UInt(b)*8+:8>;
shared/functions/crypto/FFmul0B
// FFmul0B()
// =========
bits(8) FFmul0B(bits(8) b)
bits(256*8) FFmul_0B = (
/* F E D C B A 9 8 7 6 5 4 3 2 1 0 */
/*F*/ 0xA3A8B5BE8F849992FBF0EDE6D7DCC1CA<127:0> :
/*E*/ 0x1318050E3F3429224B405D56676C717A<127:0> :
/*D*/ 0xD8D3CEC5F4FFE2E9808B969DACA7BAB1<127:0> :
/*C*/ 0x68637E75444F5259303B262D1C170A01<127:0> :
/*B*/ 0x555E434879726F640D061B10212A373C<127:0> :
/*A*/ 0xE5EEF3F8C9C2DFD4BDB6ABA0919A878C<127:0> :
/*9*/ 0x2E2538330209141F767D606B5A514C47<127:0> :
/*8*/ 0x9E958883B2B9A4AFC6CDD0DBEAE1FCF7<127:0> :
/*7*/ 0x545F424978736E650C071A11202B363D<127:0> :
/*6*/ 0xE4EFF2F9C8C3DED5BCB7AAA1909B868D<127:0> :
/*5*/ 0x2F2439320308151E777C616A5B504D46<127:0> :
/*4*/ 0x9F948982B3B8A5AEC7CCD1DAEBE0FDF6<127:0> :
/*3*/ 0xA2A9B4BF8E859893FAF1ECE7D6DDC0CB<127:0> :
/*2*/ 0x1219040F3E3528234A415C57666D707B<127:0> :
/*1*/ 0xD9D2CFC4F5FEE3E8818A979CADA6BBB0<127:0> :
/*0*/ 0x69627F74454E5358313A272C1D160B00<127:0>
);
return FFmul_0B<UInt(b)*8+:8>;
shared/functions/crypto/FFmul0D
// FFmul0D()
// =========
bits(8) FFmul0D(bits(8) b)
bits(256*8) FFmul_0D = (
/* F E D C B A 9 8 7 6 5 4 3 2 1 0 */
/*F*/ 0x979A8D80A3AEB9B4FFF2E5E8CBC6D1DC<127:0> :
/*E*/ 0x474A5D50737E69642F2235381B16010C<127:0> :
/*D*/ 0x2C21363B1815020F44495E53707D6A67<127:0> :
/*C*/ 0xFCF1E6EBC8C5D2DF94998E83A0ADBAB7<127:0> :
/*B*/ 0xFAF7E0EDCEC3D4D9929F8885A6ABBCB1<127:0> :
/*A*/ 0x2A27303D1E130409424F5855767B6C61<127:0> :
/*9*/ 0x414C5B5675786F622924333E1D10070A<127:0> :
/*8*/ 0x919C8B86A5A8BFB2F9F4E3EECDC0D7DA<127:0> :
/*7*/ 0x4D40575A7974636E25283F32111C0B06<127:0> :
/*6*/ 0x9D90878AA9A4B3BEF5F8EFE2C1CCDBD6<127:0> :
/*5*/ 0xF6FBECE1C2CFD8D59E938489AAA7B0BD<127:0> :
/*4*/ 0x262B3C31121F08054E4354597A77606D<127:0> :
/*3*/ 0x202D3A3714190E034845525F7C71666B<127:0> :
/*2*/ 0xF0FDEAE7C4C9DED39895828FACA1B6BB<127:0> :
/*1*/ 0x9B96818CAFA2B5B8F3FEE9E4C7CADDD0<127:0> :
/*0*/ 0x4B46515C7F726568232E3934171A0D00<127:0>
);
return FFmul_0D<UInt(b)*8+:8>;
I1-478 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/crypto/FFmul0E
// FFmul0E()
// =========
bits(8) FFmul0E(bits(8) b)
bits(256*8) FFmul_0E = (
/* F E D C B A 9 8 7 6 5 4 3 2 1 0 */
/*F*/ 0x8D83919FB5BBA9A7FDF3E1EFC5CBD9D7<127:0> :
/*E*/ 0x6D63717F555B49471D13010F252B3937<127:0> :
/*D*/ 0x56584A446E60727C26283A341E10020C<127:0> :
/*C*/ 0xB6B8AAA48E80929CC6C8DAD4FEF0E2EC<127:0> :
/*B*/ 0x202E3C321816040A505E4C426866747A<127:0> :
/*A*/ 0xC0CEDCD2F8F6E4EAB0BEACA28886949A<127:0> :
/*9*/ 0xFBF5E7E9C3CDDFD18B859799B3BDAFA1<127:0> :
/*8*/ 0x1B150709232D3F316B657779535D4F41<127:0> :
/*7*/ 0xCCC2D0DEF4FAE8E6BCB2A0AE848A9896<127:0> :
/*6*/ 0x2C22303E141A08065C52404E646A7876<127:0> :
/*5*/ 0x17190B052F21333D67697B755F51434D<127:0> :
/*4*/ 0xF7F9EBE5CFC1D3DD87899B95BFB1A3AD<127:0> :
/*3*/ 0x616F7D735957454B111F0D032927353B<127:0> :
/*2*/ 0x818F9D93B9B7A5ABF1FFEDE3C9C7D5DB<127:0> :
/*1*/ 0xBAB4A6A8828C9E90CAC4D6D8F2FCEEE0<127:0> :
/*0*/ 0x5A544648626C7E702A243638121C0E00<127:0>
);
return FFmul_0E<UInt(b)*8+:8>;
shared/functions/crypto/HaveAESExt
// HaveAESExt()
// ============
// TRUE if AES cryptographic instructions support is implemented,
// FALSE otherwise.
boolean HaveAESExt()
return boolean IMPLEMENTATION_DEFINED "Has AES Crypto instructions";
shared/functions/crypto/HaveBit128PMULLExt
// HaveBit128PMULLExt()
// ====================
// TRUE if 128 bit form of PMULL instructions support is implemented,
// FALSE otherwise.
boolean HaveBit128PMULLExt()
return boolean IMPLEMENTATION_DEFINED "Has 128-bit form of PMULL instructions";
shared/functions/crypto/HaveSHA1Ext
// HaveSHA1Ext()
// =============
// TRUE if SHA1 cryptographic instructions support is implemented,
// FALSE otherwise.
boolean HaveSHA1Ext()
return boolean IMPLEMENTATION_DEFINED "Has SHA1 Crypto instructions";
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-479
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/crypto/HaveSHA256Ext
// HaveSHA256Ext()
// ===============
// TRUE if SHA256 cryptographic instructions support is implemented,
// FALSE otherwise.
boolean HaveSHA256Ext()
return boolean IMPLEMENTATION_DEFINED "Has SHA256 Crypto instructions";
shared/functions/crypto/HaveSHA3Ext
// HaveSHA3Ext()
// =============
// TRUE if SHA3 cryptographic instructions support is implemented,
// and when SHA1 and SHA2 basic cryptographic instructions support is implemented,
// FALSE otherwise.
boolean HaveSHA3Ext()
if !HasArchVersion(ARMv8p2) || !(HaveSHA1Ext() && HaveSHA256Ext()) then
return FALSE;
return boolean IMPLEMENTATION_DEFINED "Has SHA3 Crypto instructions";
shared/functions/crypto/HaveSHA512Ext
// HaveSHA512Ext()
// ===============
// TRUE if SHA512 cryptographic instructions support is implemented,
// and when SHA1 and SHA2 basic cryptographic instructions support is implemented,
// FALSE otherwise.
boolean HaveSHA512Ext()
if !HasArchVersion(ARMv8p2) || !(HaveSHA1Ext() && HaveSHA256Ext()) then
return FALSE;
return boolean IMPLEMENTATION_DEFINED "Has SHA512 Crypto instructions";
shared/functions/crypto/HaveSM3Ext
// HaveSM3Ext()
// ============
// TRUE if SM3 cryptographic instructions support is implemented,
// FALSE otherwise.
boolean HaveSM3Ext()
if !HasArchVersion(ARMv8p2) then
return FALSE;
return boolean IMPLEMENTATION_DEFINED "Has SM3 Crypto instructions";
shared/functions/crypto/HaveSM4Ext
// HaveSM4Ext()
// ============
// TRUE if SM4 cryptographic instructions support is implemented,
// FALSE otherwise.
boolean HaveSM4Ext()
if !HasArchVersion(ARMv8p2) then
return FALSE;
return boolean IMPLEMENTATION_DEFINED "Has SM4 Crypto instructions";
I1-480 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/crypto/ROL
// ROL()
// =====
shared/functions/crypto/SHA256hash
// SHA256hash()
// ============
for e = 0 to 3
chs = SHAchoose(y<31:0>, y<63:32>, y<95:64>);
maj = SHAmajority(x<31:0>, x<63:32>, x<95:64>);
t = y<127:96> + SHAhashSIGMA1(y<31:0>) + chs + Elem[w, e, 32];
x<127:96> = t + x<127:96>;
y<127:96> = t + SHAhashSIGMA0(x<31:0>) + maj;
<y, x> = ROL(y : x, 32);
return (if part1 then x else y);
shared/functions/crypto/SHAchoose
// SHAchoose()
// ===========
shared/functions/crypto/SHAhashSIGMA0
// SHAhashSIGMA0()
// ===============
bits(32) SHAhashSIGMA0(bits(32) x)
return ROR(x, 2) EOR ROR(x, 13) EOR ROR(x, 22);
shared/functions/crypto/SHAhashSIGMA1
// SHAhashSIGMA1()
// ===============
bits(32) SHAhashSIGMA1(bits(32) x)
return ROR(x, 6) EOR ROR(x, 11) EOR ROR(x, 25);
shared/functions/crypto/SHAmajority
// SHAmajority()
// =============
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-481
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/crypto/SHAparity
// SHAparity()
// ===========
shared/functions/crypto/Sbox
// Sbox()
// ======
// Used in SM4E crypto instruction
sboxout = sboxstring<(255-UInt(sboxin))*8+7:(255-UInt(sboxin))*8>;
return sboxout;
shared/functions/exclusive/ClearExclusiveByAddress
// Clear the global Exclusives monitors for all PEs EXCEPT processorid if they
// record any part of the physical address region of size bytes starting at paddress.
// It is IMPLEMENTATION DEFINED whether the global Exclusives monitor for processorid
// is also cleared if it records any part of the address region.
ClearExclusiveByAddress(FullAddress paddress, integer processorid, integer size);
shared/functions/exclusive/ClearExclusiveLocal
// Clear the local Exclusives monitor for the specified processorid.
ClearExclusiveLocal(integer processorid);
shared/functions/exclusive/ClearExclusiveMonitors
// ClearExclusiveMonitors()
// ========================
// Clear the local Exclusives monitor for the executing PE.
ClearExclusiveMonitors()
ClearExclusiveLocal(ProcessorID());
shared/functions/exclusive/ExclusiveMonitorsStatus
// Returns '0' to indicate success if the last memory write by this PE was to
// the same physical address region endorsed by ExclusiveMonitorsPass().
// Returns '1' to indicate failure if address translation resulted in a different
I1-482 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// physical address.
bit ExclusiveMonitorsStatus();
shared/functions/exclusive/IsExclusiveGlobal
// Return TRUE if the global Exclusives monitor for processorid includes all of
// the physical address region of size bytes starting at paddress.
boolean IsExclusiveGlobal(FullAddress paddress, integer processorid, integer size);
shared/functions/exclusive/IsExclusiveLocal
// Return TRUE if the local Exclusives monitor for processorid includes all of
// the physical address region of size bytes starting at paddress.
boolean IsExclusiveLocal(FullAddress paddress, integer processorid, integer size);
shared/functions/exclusive/MarkExclusiveGlobal
// Record the physical address region of size bytes starting at paddress in
// the global Exclusives monitor for processorid.
MarkExclusiveGlobal(FullAddress paddress, integer processorid, integer size);
shared/functions/exclusive/MarkExclusiveLocal
// Record the physical address region of size bytes starting at paddress in
// the local Exclusives monitor for processorid.
MarkExclusiveLocal(FullAddress paddress, integer processorid, integer size);
shared/functions/exclusive/ProcessorID
// Return the ID of the currently executing PE.
integer ProcessorID();
shared/functions/extension/AArch64.HaveHPDExt
// AArch64.HaveHPDExt()
// ====================
boolean AArch64.HaveHPDExt()
return HasArchVersion(ARMv8p1);
shared/functions/extension/ArchHasVMSAExtension
// ArchHasVMSAExtension()
// ======================
boolean ArchHasVMSAExtension()
return HaveEL1VMSAExt();
shared/functions/extension/Have16bitVMID
// Have16bitVMID()
// ===============
// Returns TRUE if EL2 and support for a 16-bit VMID are implemented.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-483
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
boolean Have16bitVMID()
return (HasArchVersion(ARMv8p1) && HaveEL(EL2) &&
boolean IMPLEMENTATION_DEFINED "Has 16-bit VMID");
shared/functions/extension/Have52BitPAExt
// Have52BitPAExt()
// ================
// Returns TRUE if Large Physical Address extension
// support is implemented and FALSE otherwise.
boolean Have52BitPAExt()
return (HasArchVersion(ARMv8p2) &&
boolean IMPLEMENTATION_DEFINED "Has large 52-bit PA/IPA support");
shared/functions/extension/Have52BitVAExt
// Have52BitVAExt()
// ================
// Returns TRUE if Large Virtual Address extension
// support is implemented and FALSE otherwise.
boolean Have52BitVAExt()
return (HasArchVersion(ARMv8p2) &&
boolean IMPLEMENTATION_DEFINED "Has large 52-bit VA support");
shared/functions/extension/HaveAccessFlagUpdateExt
// HaveAccessFlagUpdateExt()
// =========================
boolean HaveAccessFlagUpdateExt()
return HasArchVersion(ARMv8p1);
shared/functions/extension/HaveAtomicExt
// HaveAtomicExt()
// ===============
boolean HaveAtomicExt()
return HasArchVersion(ARMv8p1);
shared/functions/extension/HaveBlockBBM
// HaveBlockBBM()
// ==============
// Returns TRUE if support for changing block size without requiring
// break-before-make is implemented.
boolean HaveBlockBBM()
return HasArchVersion(ARMv8p4);
shared/functions/extension/HaveCommonNotPrivateTransExt
// HaveCommonNotPrivateTransExt()
// ==============================
I1-484 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
boolean HaveCommonNotPrivateTransExt()
return HasArchVersion(ARMv8p2);
shared/functions/extension/HaveDGHExt
// HaveDGHExt()
// ============
// Returns TRUE if Data Gathering Hint instruction support is implemented, and
// FALSE otherwise.
boolean HaveDGHExt()
return boolean IMPLEMENTATION_DEFINED "Has AArch64 DGH extension";
shared/functions/extension/HaveDITExt
// HaveDITExt()
// ============
boolean HaveDITExt()
return HasArchVersion(ARMv8p4);
shared/functions/extension/HaveDOTPExt
// HaveDOTPExt()
// =============
// Returns TRUE if Dot Product feature support is implemented, and FALSE otherwise.
boolean HaveDOTPExt()
return (HasArchVersion(ARMv8p4) ||
(HasArchVersion(ARMv8p2) &&
boolean IMPLEMENTATION_DEFINED "Has Dot Product extension"));
shared/functions/extension/HaveDirtyBitModifierExt
// HaveDirtyBitModifierExt()
// =========================
boolean HaveDirtyBitModifierExt()
return HasArchVersion(ARMv8p1);
shared/functions/extension/HaveDoPD
// HaveDoPD()
// ==========
// Returns TRUE if Debug Over Power Down extension
// support is implemented and FALSE otherwise.
boolean HaveDoPD()
return HasArchVersion(ARMv8p2) && boolean IMPLEMENTATION_DEFINED "Has DoPD extension";
shared/functions/extension/HaveDoubleLock
// HaveDoubleLock()
// ================
// Returns TRUE if support for the OS Double Lock is implemented.
boolean HaveDoubleLock()
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-485
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return (!HasArchVersion(ARMv8p4) ||
boolean IMPLEMENTATION_DEFINED "OS Double Lock is implemented");
shared/functions/extension/HaveE0PDExt
// HaveE0PDExt()
// =============
// Returns TRUE if support for constant fault times for unprivileged accesses
// to the memory map is implemented.
boolean HaveE0PDExt()
return HasArchVersion(ARMv8p5);
shared/functions/extension/HaveEL1VMSAExt
// HaveEL1VMSAExt()
// ================
// Returns TRUE if VMSA is supported at stage1 EL1&0 translation regime, FALSE otherwise.
boolean HaveEL1VMSAExt()
return ID_AA64MMFR0_EL1.MSA == '1111' && ID_AA64MMFR0_EL1.MSA_frac == '0010';
shared/functions/extension/HaveExtendedCacheSets
// HaveExtendedCacheSets()
// =======================
boolean HaveExtendedCacheSets()
return HasArchVersion(ARMv8p3);
shared/functions/extension/HaveExtendedECDebugEvents
// HaveExtendedECDebugEvents()
// ===========================
boolean HaveExtendedECDebugEvents()
return HasArchVersion(ARMv8p2);
shared/functions/extension/HaveExtendedExecuteNeverExt
// HaveExtendedExecuteNeverExt()
// =============================
boolean HaveExtendedExecuteNeverExt()
return HasArchVersion(ARMv8p2);
shared/functions/extension/HaveFCADDExt
// HaveFCADDExt()
// ==============
boolean HaveFCADDExt()
return HasArchVersion(ARMv8p3);
I1-486 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/extension/HaveFJCVTZSExt
// HaveFJCVTZSExt()
// ================
boolean HaveFJCVTZSExt()
return HasArchVersion(ARMv8p3);
shared/functions/extension/HaveFP16MulNoRoundingToFP32Ext
// HaveFP16MulNoRoundingToFP32Ext()
// ================================
// Returns TRUE if has FP16 multiply with no intermediate rounding accumulate
// to FP32 instructions, and FALSE otherwise
boolean HaveFP16MulNoRoundingToFP32Ext()
if !HaveFP16Ext() then return FALSE;
if HasArchVersion(ARMv8p4) then return TRUE;
return (HasArchVersion(ARMv8p2) &&
boolean IMPLEMENTATION_DEFINED "Has accumulate FP16 product into FP32 extension");
shared/functions/extension/HaveFlagManipulateExt
// HaveFlagManipulateExt()
// =======================
// Returns TRUE if flag manipulate instructions are implemented.
boolean HaveFlagManipulateExt()
return HasArchVersion(ARMv8p4);
shared/functions/extension/HaveHPMDExt
// HaveHPMDExt()
// =============
boolean HaveHPMDExt()
return HavePMUv3p1();
shared/functions/extension/HaveIDSExt
// HaveIDSExt()
// ============
// Returns TRUE if ID register handling feature is implemented.
boolean HaveIDSExt()
return HasArchVersion(ARMv8p4);
shared/functions/extension/HaveIESB
// HaveIESB()
// ==========
boolean HaveIESB()
return (HaveRASExt() &&
boolean IMPLEMENTATION_DEFINED "Has Implicit Error Synchronization Barrier");
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-487
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/extension/HaveLSE2Ext
// HaveLSE2Ext()
// =============
// Returns TRUE if LSE2 is implemented, and FALSE otherwise.
boolean HaveLSE2Ext()
return HasArchVersion(ARMv8p4);
shared/functions/extension/HaveNoSecurePMUDisableOverride
// HaveNoSecurePMUDisableOverride()
// ================================
boolean HaveNoSecurePMUDisableOverride()
return HasArchVersion(ARMv8p2);
shared/functions/extension/HaveNoninvasiveDebugAuth
// HaveNoninvasiveDebugAuth()
// ==========================
// Returns TRUE if the Non-invasive debug controls are implemented.
boolean HaveNoninvasiveDebugAuth()
return !HasArchVersion(ARMv8p4);
shared/functions/extension/HavePANExt
// HavePANExt()
// ============
boolean HavePANExt()
return HasArchVersion(ARMv8p1);
shared/functions/extension/HavePMUv3
// HavePMUv3()
// ===========
// Returns TRUE if the Performance Monitors extension is implemented, and FALSE otherwise.
boolean HavePMUv3()
return boolean IMPLEMENTATION_DEFINED "Has Performance Monitors extension";
shared/functions/extension/HavePMUv3p1
// HavePMUv3p1()
// =============
// Returns TRUE if the Performance Monitors extension is implemented, and FALSE otherwise.
boolean HavePMUv3p1()
return HasArchVersion(ARMv8p1) && HavePMUv3();
shared/functions/extension/HavePageBasedHardwareAttributes
// HavePageBasedHardwareAttributes()
// =================================
I1-488 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
boolean HavePageBasedHardwareAttributes()
return HasArchVersion(ARMv8p2);
shared/functions/extension/HavePrivATExt
// HavePrivATExt()
// ===============
boolean HavePrivATExt()
return HasArchVersion(ARMv8p2);
shared/functions/extension/HaveQRDMLAHExt
// HaveQRDMLAHExt()
// ================
boolean HaveQRDMLAHExt()
return HasArchVersion(ARMv8p1);
shared/functions/extension/HaveRASExt
// HaveRASExt()
// ============
boolean HaveRASExt()
return (HasArchVersion(ARMv8p2) ||
boolean IMPLEMENTATION_DEFINED "Has RAS extension");
shared/functions/extension/HaveSBExt
// HaveSBExt()
// ===========
// Returns TRUE if support for SB is implemented, and FALSE otherwise.
boolean HaveSBExt()
return HasArchVersion(ARMv8p5) || boolean IMPLEMENTATION_DEFINED "Has SB extension";
shared/functions/extension/HaveSSBSExt
// HaveSSBSExt()
// =============
// Returns TRUE if support for SSBS is implemented, and FALSE otherwise.
boolean HaveSSBSExt()
return HasArchVersion(ARMv8p5) || boolean IMPLEMENTATION_DEFINED "Has SSBS extension";
shared/functions/extension/HaveSecureEL2Ext
// HaveSecureEL2Ext()
// ==================
// Returns TRUE if Secure EL2 is implemented.
boolean HaveSecureEL2Ext()
return HasArchVersion(ARMv8p4);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-489
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/extension/HaveSecureExtDebugView
// HaveSecureExtDebugView()
// ========================
// Returns TRUE if support for Secure and Non-secure views of debug peripherals
// is implemented.
boolean HaveSecureExtDebugView()
return HasArchVersion(ARMv8p4);
shared/functions/extension/HaveSelfHostedTrace
// HaveSelfHostedTrace()
// =====================
boolean HaveSelfHostedTrace()
return HasArchVersion(ARMv8p4);
shared/functions/extension/HaveSmallTranslationTblExt
// HaveSmallTranslationTblExt()
// ============================
// Returns TRUE if Small Translation Table Support is implemented.
boolean HaveSmallTranslationTableExt()
return (HasArchVersion(ARMv8p4) &&
boolean IMPLEMENTATION_DEFINED "Has Small Translation Table extension");
shared/functions/extension/HaveSoftwareLock
// HaveSoftwareLock()
// ==================
// Returns TRUE if Software Lock is implemented.
shared/functions/extension/HaveStage2MemAttrControl
// HaveStage2MemAttrControl()
// ==========================
// Returns TRUE if support for Stage2 control of memory types and cacheability
// attributes is implemented.
boolean HaveStage2MemAttrControl()
return HasArchVersion(ARMv8p4);
I1-490 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/extension/HaveTraceExt
// HaveTraceExt()
// ==============
// Returns TRUE if Trace functionality as described by the Trace Architecture
// is implemented.
boolean HaveTraceExt()
return boolean IMPLEMENTATION_DEFINED "Has Trace Architecture functionality";
shared/functions/extension/HaveUAOExt
// HaveUAOExt()
// ============
boolean HaveUAOExt()
return HasArchVersion(ARMv8p2);
shared/functions/extension/HaveV82Debug
// HaveV82Debug()
// ==============
boolean HaveV82Debug()
return HasArchVersion(ARMv8p2);
shared/functions/extension/Havev8p4Debug
// Havev8p4Debug()
// ===============
// Returns TRUE if support for the Debugv8p4 feature is implemented and FALSE otherwise.
boolean Havev8p4Debug()
return HasArchVersion(ARMv8p4);
shared/functions/extension/InsertIESBBeforeException
// If SCTLR_ELx.IESB is 1 when an exception is generated to ELx, any pending Unrecoverable
// SError interrupt must be taken before executing any instructions in the exception handler.
// However, this can be before the branch to the exception handler is made.
boolean InsertIESBBeforeException(bits(2) el);
shared/functions/externalaborts/HandleExternalAbort
// HandleExternalAbort()
// =====================
// Takes a Synchronous/Asynchronous abort based on fault.
fault = NoFault();
fault.statuscode = memretstatus.statuscode;
fault.write = iswrite;
fault.extflag = memretstatus.extflag;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-491
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
fault.acctype = memretstatus.acctype;
// It is implementation specific whether External aborts signaled
// in-band synchronously are taken synchronously or asynchronously
if (IsExternalSyncAbort(fault) &&
!IsExternalAbortTakenSynchronously(memretstatus, iswrite, memaddrdesc,
size, accdesc)) then
if fault.statuscode == Fault_SyncParity then
fault.statuscode = Fault_AsyncParity;
else
fault.statuscode = Fault_AsyncExternal;
if HaveRASExt() then
fault.errortype = PEErrorState(memretstatus);
else
fault.errortype = bits(2) UNKNOWN;
if IsExternalSyncAbort(fault) then
if UsingAArch32() then
AArch32.Abort(memaddrdesc.vaddress<31:0>, fault);
else
AArch64.Abort(memaddrdesc.vaddress, fault);
else
PendSErrorInterrupt(fault);
shared/functions/externalaborts/HandleExternalReadAbort
// HandleExternalReadAbort()
// =========================
// Wrapper function for HandleExternalAbort function in case of an External
// Abort on memory read.
shared/functions/externalaborts/HandleExternalTTWAbort
// HandleExternalTTWAbort()
// ========================
// Take Asynchronous abort or update FaultRecord for Translation Table Walk
// based on PhysMemRetStatus.
I1-492 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
output_fault.statuscode = Fault_SyncParityOnWalk;
else
output_fault.statuscode = Fault_SyncExternalOnWalk;
if HaveRASExt() then
output_fault.errortype = PEErrorState(memretstatus);
else
output_fault.errortype = bits(2) UNKNOWN;
if !IsExternalSyncAbort(output_fault) then
PendSErrorInterrupt(output_fault);
output_fault.statuscode = Fault_None;
return output_fault;
shared/functions/externalaborts/HandleExternalWriteAbort
// HandleExternalWriteAbort()
// ==========================
// Wrapper function for HandleExternalAbort function in case of an External
// Abort on memory write.
shared/functions/externalaborts/IsExternalAbortTakenSynchronously
// Return an implementation specific value:
// TRUE if the fault returned for the access can be taken synchronously,
// FALSE otherwise.
//
// This might vary between accesses, for example depending on the error type
// or memory type being accessed.
// External aborts on data accesses and translation table walks on data accesses
// can be either synchronous or asynchronous.
//
// When FEAT_DoubleFault is not implemented, External aborts on instruction
// fetches and translation table walks on instruction fetches can be either
// synchronous or asynchronous.
// When FEAT_DoubleFault is implemented, all External abort exceptions on
// instruction fetches and translation table walks on instruction fetches
// must be synchronous.
boolean IsExternalAbortTakenSynchronously(PhysMemRetStatus memstatus,
boolean iswrite,
AddressDescriptor desc,
integer size,
AccessDescriptor accdesc);
shared/functions/externalaborts/PEErrorState
constant bits(2) Sync_UC = '10'; // Synchronous Uncontainable
constant bits(2) Sync_UER = '00'; // Synchronous Recoverable
constant bits(2) Sync_UEO = '11'; // Synchronous Restartable
constant bits(2) ASync_UC = '00'; // ASynchronous Uncontainable
constant bits(2) ASync_UEU = '01'; // ASynchronous Unrecoverable
constant bits(2) ASync_UER = '11'; // ASynchronous Recoverable
constant bits(2) ASync_UEO = '10'; // ASynchronous Restartable
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-493
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/externalaborts/PendSErrorInterrupt
// Pend the SError.
PendSErrorInterrupt(FaultRecord fault);
shared/functions/float/fixedtofp/FixedToFP
// FixedToFP()
// ===========
bits(N) FixedToFP(bits(M) op, integer fbits, boolean unsigned, FPCRType fpcr, FPRounding rounding)
assert N IN {16,32,64};
assert M IN {16,32,64};
bits(N) result;
assert fbits >= 0;
assert rounding != FPRounding_ODD;
// Correct signed-ness
int_operand = Int(op, unsigned);
return result;
shared/functions/float/fpabs/FPAbs
// FPAbs()
// =======
assert N IN {16,32,64};
shared/functions/float/fpadd/FPAdd
// FPAdd()
// =======
assert N IN {16,32,64};
rounding = FPRoundingMode(fpcr);
I1-494 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
result = FPDefaultNaN();
FPProcessException(FPExc_InvalidOp, fpcr);
elsif (inf1 && sign1 == '0') || (inf2 && sign2 == '0') then
result = FPInfinity('0');
elsif (inf1 && sign1 == '1') || (inf2 && sign2 == '1') then
result = FPInfinity('1');
elsif zero1 && zero2 && sign1 == sign2 then
result = FPZero(sign1);
else
result_value = value1 + value2;
if result_value == 0.0 then // Sign of exact zero result depends on rounding mode
result_sign = if rounding == FPRounding_NEGINF then '1' else '0';
result = FPZero(result_sign);
else
result = FPRound(result_value, fpcr, rounding);
return result;
shared/functions/float/fpcompare/FPCompare
// FPCompare()
// ===========
assert N IN {16,32,64};
(type1,sign1,value1) = FPUnpack(op1, fpcr);
(type2,sign2,value2) = FPUnpack(op2, fpcr);
bits(4) result;
if type1 IN {FPType_SNaN, FPType_QNaN} || type2 IN {FPType_SNaN, FPType_QNaN} then
result = '0011';
if type1 == FPType_SNaN || type2 == FPType_SNaN || signal_nans then
FPProcessException(FPExc_InvalidOp, fpcr);
else
// All non-NaN cases can be evaluated on the values produced by FPUnpack()
if value1 == value2 then
result = '0110';
elsif value1 < value2 then
result = '1000';
else // value1 > value2
result = '0010';
return result;
shared/functions/float/fpcompareeq/FPCompareEQ
// FPCompareEQ()
// =============
assert N IN {16,32,64};
(type1,sign1,value1) = FPUnpack(op1, fpcr);
(type2,sign2,value2) = FPUnpack(op2, fpcr);
boolean result;
if type1 IN {FPType_SNaN, FPType_QNaN} || type2 IN {FPType_SNaN, FPType_QNaN} then
result = FALSE;
if type1 == FPType_SNaN || type2 == FPType_SNaN then
FPProcessException(FPExc_InvalidOp, fpcr);
else
// All non-NaN cases can be evaluated on the values produced by FPUnpack()
result = (value1 == value2);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-495
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return result;
shared/functions/float/fpcomparege/FPCompareGE
// FPCompareGE()
// =============
assert N IN {16,32,64};
(type1,sign1,value1) = FPUnpack(op1, fpcr);
(type2,sign2,value2) = FPUnpack(op2, fpcr);
boolean result;
if type1 IN {FPType_SNaN, FPType_QNaN} || type2 IN {FPType_SNaN, FPType_QNaN} then
result = FALSE;
FPProcessException(FPExc_InvalidOp, fpcr);
else
// All non-NaN cases can be evaluated on the values produced by FPUnpack()
result = (value1 >= value2);
return result;
shared/functions/float/fpcomparegt/FPCompareGT
// FPCompareGT()
// =============
assert N IN {16,32,64};
(type1,sign1,value1) = FPUnpack(op1, fpcr);
(type2,sign2,value2) = FPUnpack(op2, fpcr);
boolean result;
if type1 IN {FPType_SNaN, FPType_QNaN} || type2 IN {FPType_SNaN, FPType_QNaN} then
result = FALSE;
FPProcessException(FPExc_InvalidOp, fpcr);
else
// All non-NaN cases can be evaluated on the values produced by FPUnpack()
result = (value1 > value2);
return result;
shared/functions/float/fpconvert/FPConvert
// FPConvert()
// ===========
assert M IN {16,32,64};
assert N IN {16,32,64};
bits(M) result;
I1-496 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return result;
// FPConvert()
// ===========
shared/functions/float/fpconvertnan/FPConvertNaN
// FPConvertNaN()
// ==============
// Converts a NaN of one floating-point type to another
assert N IN {16,32,64};
assert M IN {16,32,64};
bits(M) result;
bits(51) frac;
sign = op<N-1>;
return result;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-497
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/float/fpcrtype/FPCRType
type FPCRType;
shared/functions/float/fpdecoderm/FPDecodeRM
// FPDecodeRM()
// ============
FPRounding result;
case rm of
when '00' result = FPRounding_TIEAWAY; // A
when '01' result = FPRounding_TIEEVEN; // N
when '10' result = FPRounding_POSINF; // P
when '11' result = FPRounding_NEGINF; // M
return result;
shared/functions/float/fpdecoderounding/FPDecodeRounding
// FPDecodeRounding()
// ==================
shared/functions/float/fpdefaultnan/FPDefaultNaN
// FPDefaultNaN()
// ==============
bits(N) FPDefaultNaN()
assert N IN {16,32,64};
constant integer E = (if N == 16 then 5 elsif N == 32 then 8 else 11);
constant integer F = N - (E + 1);
bit sign = '0';
shared/functions/float/fpdiv/FPDiv
// FPDiv()
// =======
assert N IN {16,32,64};
I1-498 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
if !done then
inf1 = type1 == FPType_Infinity;
inf2 = type2 == FPType_Infinity;
zero1 = type1 == FPType_Zero;
zero2 = type2 == FPType_Zero;
return result;
shared/functions/float/fpexc/FPExc
enumeration FPExc {FPExc_InvalidOp, FPExc_DivideByZero, FPExc_Overflow,
FPExc_Underflow, FPExc_Inexact, FPExc_InputDenorm};
shared/functions/float/fpinfinity/FPInfinity
// FPInfinity()
// ============
assert N IN {16,32,64};
constant integer E = (if N == 16 then 5 elsif N == 32 then 8 else 11);
constant integer F = N - (E + 1);
bits(E) exp = Ones(E);
bits(F) frac = Zeros(F);
shared/functions/float/fpmax/FPMax
// FPMax()
// =======
// Compare two inputs and return the greater value after rounding. The
// 'fpcr' argument supplies the FPCR control bits.
if !done then
FPType fptype;
bit sign;
real value;
if value1 > value2 then
(fptype,sign,value) = (type1,sign1,value1);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-499
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
else
(fptype,sign,value) = (type2,sign2,value2);
if fptype == FPType_Infinity then
result = FPInfinity(sign);
elsif fptype == FPType_Zero then
sign = sign1 AND sign2; // Use most positive sign
result = FPZero(sign);
else
// The use of FPRound() covers the case where there is a trapped underflow exception
// for a denormalized number even though the result is exact.
rounding = FPRoundingMode(fpcr);
result = FPRound(value, fpcr, rounding);
return result;
shared/functions/float/fpmaxnormal/FPMaxNormal
// FPMaxNormal()
// =============
assert N IN {16,32,64};
constant integer E = (if N == 16 then 5 elsif N == 32 then 8 else 11);
constant integer F = N - (E + 1);
exp = Ones(E-1):'0';
frac = Ones(F);
shared/functions/float/fpmaxnum/FPMaxNum
// FPMaxNum()
// ==========
assert N IN {16,32,64};
bits(N) op1 = op1_in;
bits(N) op2 = op2_in;
(type1,-,-) = FPUnpack(op1, fpcr);
(type2,-,-) = FPUnpack(op2, fpcr);
return result;
shared/functions/float/fpmerge/IsMerging
// IsMerging()
// ===========
// Returns TRUE if the output elements other than the lowest are taken from
// the destination register.
I1-500 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/float/fpmin/FPMin
// FPMin()
// =======
// Compare two operands and return the smaller operand after rounding. The
// 'fpcr' argument supplies the FPCR control bits.
if !done then
FPType fptype;
bit sign;
real value;
FPRounding rounding;
if value1 < value2 then
(fptype,sign,value) = (type1,sign1,value1);
else
(fptype,sign,value) = (type2,sign2,value2);
if fptype == FPType_Infinity then
result = FPInfinity(sign);
elsif fptype == FPType_Zero then
sign = sign1 OR sign2; // Use most negative sign
result = FPZero(sign);
else
// The use of FPRound() covers the case where there is a trapped underflow exception
// for a denormalized number even though the result is exact.
rounding = FPRoundingMode(fpcr);
result = FPRound(value, fpcr, rounding);
return result;
shared/functions/float/fpminnum/FPMinNum
// FPMinNum()
// ==========
assert N IN {16,32,64};
bits(N) op1 = op1_in;
bits(N) op2 = op2_in;
(type1,-,-) = FPUnpack(op1, fpcr);
(type2,-,-) = FPUnpack(op2, fpcr);
return result;
shared/functions/float/fpmul/FPMul
// FPMul()
// =======
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-501
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
assert N IN {16,32,64};
(type1,sign1,value1) = FPUnpack(op1, fpcr);
(type2,sign2,value2) = FPUnpack(op2, fpcr);
(done,result) = FPProcessNaNs(type1, type2, op1, op2, fpcr);
if !done then
inf1 = (type1 == FPType_Infinity);
inf2 = (type2 == FPType_Infinity);
zero1 = (type1 == FPType_Zero);
zero2 = (type2 == FPType_Zero);
return result;
shared/functions/float/fpmuladd/FPMulAdd
// FPMulAdd()
// ==========
//
// Calculates addend + op1*op2 with a single rounding. The 'fpcr' argument
// supplies the FPCR control bits.
if typeA == FPType_QNaN && ((inf1 && zero2) || (zero1 && inf2)) then
result = FPDefaultNaN();
FPProcessException(FPExc_InvalidOp, fpcr);
if !done then
infA = (typeA == FPType_Infinity); zeroA = (typeA == FPType_Zero);
// Determine sign and type product will have if it does not cause an
// Invalid Operation.
signP = sign1 EOR sign2;
infP = inf1 || inf2;
zeroP = zero1 || zero2;
if invalidop then
result = FPDefaultNaN();
FPProcessException(FPExc_InvalidOp, fpcr);
// Other cases involving infinities produce an infinity of the same sign.
elsif (infA && signA == '0') || (infP && signP == '0') then
I1-502 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
result = FPInfinity('0');
elsif (infA && signA == '1') || (infP && signP == '1') then
result = FPInfinity('1');
// Cases where the result is exactly zero and its sign is not determined by the
// rounding mode are additions of same-signed zeros.
elsif zeroA && zeroP && signA == signP then
result = FPZero(signA);
return result;
shared/functions/float/fpmuladdh/FPMulAddH
// FPMulAddH()
// ===========
// Calculates addend + op1*op2.
bits(N) FPMulAddH(bits(N) addend, bits(N DIV 2) op1, bits(N DIV 2) op2, FPCRType fpcr)
assert N == 32;
rounding = FPRoundingMode(fpcr);
(typeA,signA,valueA) = FPUnpack(addend, fpcr);
(type1,sign1,value1) = FPUnpack(op1, fpcr);
(type2,sign2,value2) = FPUnpack(op2, fpcr);
inf1 = (type1 == FPType_Infinity); zero1 = (type1 == FPType_Zero);
inf2 = (type2 == FPType_Infinity); zero2 = (type2 == FPType_Zero);
if typeA == FPType_QNaN && ((inf1 && zero2) || (zero1 && inf2)) then
result = FPDefaultNaN();
FPProcessException(FPExc_InvalidOp, fpcr);
if !done then
infA = (typeA == FPType_Infinity); zeroA = (typeA == FPType_Zero);
// Determine sign and type product will have if it does not cause an
// Invalid Operation.
signP = sign1 EOR sign2;
infP = inf1 || inf2;
zeroP = zero1 || zero2;
// Non SNaN-generated Invalid Operation cases are multiplies of zero by infinity and
// additions of opposite-signed infinities.
invalidop = (inf1 && zero2) || (zero1 && inf2) || (infA && infP && signA != signP);
if invalidop then
result = FPDefaultNaN();
FPProcessException(FPExc_InvalidOp, fpcr);
// Cases where the result is exactly zero and its sign is not determined by the
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-503
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return result;
shared/functions/float/fpmuladdh/FPProcessNaNs3H
// FPProcessNaNs3H()
// =================
assert N IN {32,64};
bits(N) result;
boolean done;
if type1 == FPType_SNaN then
done = TRUE; result = FPProcessNaN(type1, op1, fpcr);
elsif type2 == FPType_SNaN then
done = TRUE; result = FPConvertNaN(FPProcessNaN(type2, op2, fpcr));
elsif type3 == FPType_SNaN then
done = TRUE; result = FPConvertNaN(FPProcessNaN(type3, op3, fpcr));
elsif type1 == FPType_QNaN then
done = TRUE; result = FPProcessNaN(type1, op1, fpcr);
elsif type2 == FPType_QNaN then
done = TRUE; result = FPConvertNaN(FPProcessNaN(type2, op2, fpcr));
elsif type3 == FPType_QNaN then
done = TRUE; result = FPConvertNaN(FPProcessNaN(type3, op3, fpcr));
else
done = FALSE; result = Zeros(); // 'Don't care' result
shared/functions/float/fpmulx/FPMulX
// FPMulX()
// ========
assert N IN {16,32,64};
bits(N) result;
boolean done;
(type1,sign1,value1) = FPUnpack(op1, fpcr);
(type2,sign2,value2) = FPUnpack(op2, fpcr);
I1-504 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return result;
shared/functions/float/fpneg/FPNeg
// FPNeg()
// =======
assert N IN {16,32,64};
shared/functions/float/fponepointfive/FPOnePointFive
// FPOnePointFive()
// ================
assert N IN {16,32,64};
constant integer E = (if N == 16 then 5 elsif N == 32 then 8 else 11);
constant integer F = N - (E + 1);
exp = '0':Ones(E-1);
frac = '1':Zeros(F-1);
result = sign : exp : frac;
return result;
shared/functions/float/fpprocessexception/FPProcessException
// FPProcessException()
// ====================
//
// The 'fpcr' argument supplies FPCR control bits. Status information is
// updated directly in the FPSR where appropriate.
integer cumul;
// Determine the cumulative exception bit number
case exception of
when FPExc_InvalidOp cumul = 0;
when FPExc_DivideByZero cumul = 1;
when FPExc_Overflow cumul = 2;
when FPExc_Underflow cumul = 3;
when FPExc_Inexact cumul = 4;
when FPExc_InputDenorm cumul = 7;
enable = cumul + 8;
if fpcr<enable> == '1' then
// Trapping of the exception enabled.
// It is IMPLEMENTATION DEFINED whether the enable bit may be set at all,
// and if so then how exceptions and in what order that they may be
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-505
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return;
shared/functions/float/fpprocessnan/FPProcessNaN
// FPProcessNaN()
// ==============
// Handle NaN input operands, returning the operand or default NaN value
// if fpcr.DN is selected. The 'fpcr' argument supplies the FPCR control bits.
case N of
when 16 topfrac = 9;
when 32 topfrac = 22;
when 64 topfrac = 51;
result = op;
if fptype == FPType_SNaN then
result<topfrac> = '1';
FPProcessException(FPExc_InvalidOp, fpcr);
if fpcr.DN == '1' then // DefaultNaN requested
result = FPDefaultNaN();
return result;
shared/functions/float/fpprocessnans/FPProcessNaNs
// FPProcessNaNs()
// ===============
//
// The boolean part of the return value says whether a NaN has been found and
// processed. The bits(N) part is only relevant if it has and supplies the
// result of the operation.
//
// The 'fpcr' argument supplies FPCR control bits. Status information is
// updated directly in the FPSR where appropriate.
I1-506 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
boolean done;
bits(N) result;
if type1 == FPType_SNaN then
done = TRUE; result = FPProcessNaN(type1, op1, fpcr);
elsif type2 == FPType_SNaN then
done = TRUE; result = FPProcessNaN(type2, op2, fpcr);
elsif type1 == FPType_QNaN then
done = TRUE; result = FPProcessNaN(type1, op1, fpcr);
elsif type2 == FPType_QNaN then
done = TRUE; result = FPProcessNaN(type2, op2, fpcr);
else
done = FALSE; result = Zeros(); // 'Don't care' result
return (done, result);
shared/functions/float/fpprocessnans3/FPProcessNaNs3
// FPProcessNaNs3()
// ================
//
// The boolean part of the return value says whether a NaN has been found and
// processed. The bits(N) part is only relevant if it has and supplies the
// result of the operation.
//
// The 'fpcr' argument supplies FPCR control bits. Status information is
// updated directly in the FPSR where appropriate.
shared/functions/float/fprecipestimate/FPRecipEstimate
// FPRecipEstimate()
// =================
assert N IN {16,32,64};
FPCRType fpcr = fpcr_in;
bits(N) result;
boolean overflow_to_inf;
(fptype,sign,value) = FPUnpack(operand, fpcr);
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-507
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
if exp == 0 then
if fraction<51> == '0' then
exp = -1;
fraction = fraction<49:0>:'00';
else
fraction = fraction<50:0>:'0';
integer result_exp;
case N of
when 16 result_exp = 29 - exp; // In range 29-30 = -1 to 29+1 = 30
when 32 result_exp = 253 - exp; // In range 253-254 = -1 to 253+1 = 254
I1-508 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// Scaled is in range 256 .. 511 representing a fixed-point number in range [0.5 .. 1.0].
estimate = RecipEstimate(scaled);
if result_exp == 0 then
fraction = '1' : fraction<51:1>;
elsif result_exp == -1 then
fraction = '01' : fraction<51:2>;
result_exp = 0;
case N of
when 16 result = sign : result_exp<N-12:0> : fraction<51:42>;
when 32 result = sign : result_exp<N-25:0> : fraction<51:29>;
when 64 result = sign : result_exp<N-54:0> : fraction<51:0>;
return result;
shared/functions/float/fprecipestimate/RecipEstimate
// RecipEstimate()
// ===============
// Compute estimate of reciprocal of 9-bit fixed-point number.
//
// a is in range 256 .. 511 representing a number in the range 0.5 <= x < 1.0.
// result is in the range 256 .. 511 representing a number in the range 1.0 to 511/256.
shared/functions/float/fprecpx/FPRecpX
// FPRecpX()
// =========
assert N IN {16,32,64};
FPCRType fpcr = fpcr_in;
integer esize;
case N of
when 16 esize = 5;
when 32 esize = 8;
when 64 esize = 11;
bits(N) result;
bits(esize) exp;
bits(esize) max_exp;
bits(N-(esize+1)) frac = Zeros();
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-509
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
case N of
when 16 exp = op<10+esize-1:10>;
when 32 exp = op<23+esize-1:23>;
when 64 exp = op<52+esize-1:52>;
max_exp = Ones(esize) - 1;
return result;
shared/functions/float/fpround/FPRound
// FPRound()
// =========
// Used by data processing and int/fixed <-> FP conversion instructions.
// For half-precision data it ignores AHP, and observes FZ16.
// FPRound()
// =========
shared/functions/float/fpround/FPRoundBase
// FPRoundBase()
// =============
// Convert a real number 'op' into an N-bit floating-point value using the
// supplied rounding mode 'rounding'.
// Obtain format parameters - minimum exponent, numbers of exponent and fraction bits.
integer minimum_exp;
integer F;
integer E;
if N == 16 then
minimum_exp = -14; E = 5; F = 10;
elsif N == 32 then
minimum_exp = -126; E = 8; F = 23;
else // N == 64
minimum_exp = -1022; E = 11; F = 52;
I1-510 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
else
sign = '0'; mantissa = op;
exponent = 0;
while mantissa < 1.0 do
mantissa = mantissa * 2.0; exponent = exponent - 1;
while mantissa >= 2.0 do
mantissa = mantissa / 2.0; exponent = exponent + 1;
// Start creating the exponent value for the result. Start by biasing the actual exponent
// so that the minimum exponent becomes 1, lower values 0 (indicating possible underflow).
biased_exp = Max((exponent - minimum_exp) + 1, 0);
if biased_exp == 0 then mantissa = mantissa / 2.0^(minimum_exp - exponent);
// Get the unrounded mantissa as an integer, and the "units in last place" rounding error.
int_mant = RoundDown(mantissa * 2.0^F); // < 2.0^F if biased_exp == 0, >= 2.0^F if not
error = mantissa * 2.0^F - Real(int_mant);
// Underflow occurs if exponent is too small before rounding, and result is inexact or
// the Underflow exception is trapped.
if biased_exp == 0 && (error != 0.0 || fpcr.UFE == '1') then
FPProcessException(FPExc_Underflow, fpcr);
if round_up then
int_mant = int_mant + 1;
if int_mant == 2^F then // Rounded up from denormalized to normalized
biased_exp = 1;
if int_mant == 2^(F+1) then // Rounded up to next exponent
biased_exp = biased_exp + 1;
int_mant = int_mant DIV 2;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-511
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return result;
shared/functions/float/fpround/FPRoundCV
// FPRoundCV()
// ===========
// Used for FP <-> FP conversion instructions.
// For half-precision data ignores FZ16 and observes AHP.
shared/functions/float/fprounding/FPRounding
enumeration FPRounding {FPRounding_TIEEVEN, FPRounding_POSINF,
FPRounding_NEGINF, FPRounding_ZERO,
FPRounding_TIEAWAY, FPRounding_ODD};
shared/functions/float/fproundingmode/FPRoundingMode
// FPRoundingMode()
// ================
// Return the current floating-point rounding mode.
shared/functions/float/fproundint/FPRoundInt
// FPRoundInt()
// ============
// Round op to nearest integral floating point value using rounding mode in FPCR/FPSCR.
// If EXACT is TRUE, set FPSR.IXC if result is not numerically equal to op.
bits(N) result;
if fptype == FPType_SNaN || fptype == FPType_QNaN then
result = FPProcessNaN(fptype, op, fpcr);
elsif fptype == FPType_Infinity then
I1-512 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
result = FPInfinity(sign);
elsif fptype == FPType_Zero then
result = FPZero(sign);
else
// Extract integer component.
int_result = RoundDown(value);
error = value - Real(int_result);
return result;
shared/functions/float/fproundintn/FPRoundIntN
// FPRoundIntN()
// =============
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-513
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
result = FPZero(sign);
else
// Extract integer component.
int_result = RoundDown(value);
error = value - Real(int_result);
if overflow then
if N == 32 then
exp = 126 + intsize;
result = '1':exp<(E-1):0>:Zeros(F);
else
exp = 1022 + intsize;
result = '1':exp<(E-1):0>:Zeros(F);
FPProcessException(FPExc_InvalidOp, fpcr);
// This case shouldn't set Inexact.
error = 0.0;
else
// Convert integer value into an equivalent real value.
real_result = Real(int_result);
return result;
shared/functions/float/fprsqrtestimate/FPRSqrtEstimate
// FPRSqrtEstimate()
// =================
assert N IN {16,32,64};
FPCRType fpcr = fpcr_in;
bits(N) result;
if fptype == FPType_SNaN || fptype == FPType_QNaN then
result = FPProcessNaN(fptype, operand, fpcr);
elsif fptype == FPType_Zero then
result = FPInfinity(sign);
I1-514 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
FPProcessException(FPExc_DivideByZero, fpcr);
elsif sign == '1' then
result = FPDefaultNaN();
FPProcessException(FPExc_InvalidOp, fpcr);
elsif fptype == FPType_Infinity then
result = FPZero('0');
else
// Scale to a fixed-point value in the range 0.25 <= x < 1.0 in steps of 512, with the
// evenness or oddness of the exponent unchanged, and calculate result exponent.
// Scaled value has copied sign bit, exponent = 1022 or 1021 = double-precision
// biased version of -1 or -2, fraction = original fraction extended with zeros.
bits(52) fraction;
integer exp;
case N of
when 16
fraction = operand<9:0> : Zeros(42);
exp = UInt(operand<14:10>);
when 32
fraction = operand<22:0> : Zeros(29);
exp = UInt(operand<30:23>);
when 64
fraction = operand<51:0>;
exp = UInt(operand<62:52>);
if exp == 0 then
while fraction<51> == '0' do
fraction = fraction<50:0> : '0';
exp = exp - 1;
fraction = fraction<50:0> : '0';
integer scaled;
if exp<0> == '0' then
scaled = UInt('1':fraction<51:44>);
else
scaled = UInt('01':fraction<51:45>);
integer result_exp;
case N of
when 16 result_exp = ( 44 - exp) DIV 2;
when 32 result_exp = ( 380 - exp) DIV 2;
when 64 result_exp = (3068 - exp) DIV 2;
estimate = RecipSqrtEstimate(scaled);
return result;
shared/functions/float/fprsqrtestimate/RecipSqrtEstimate
// RecipSqrtEstimate()
// ===================
// Compute estimate of reciprocal square root of 9-bit fixed-point number.
//
// a_in is in range 128 .. 511 representing a number in the range 0.25 <= x < 1.0.
// result is in the range 256 .. 511 representing a number in the range in the range 1.0 to 511/256.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-515
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
integer a = a_in;
assert 128 <= a && a < 512;
if a < 256 then // 0.25 .. 0.5
a = a*2+1; // a in units of 1/512 rounded to nearest
else // 0.5 .. 1.0
a = (a >> 1) << 1; // Discard bottom bit
a = (a+1)*2; // a in units of 1/256 rounded to nearest
integer b = 512;
while a*(b+1)*(b+1) < 2^28 do
b = b+1; // b = largest b such that b < 2^14 / sqrt(a)
r = (b+1) DIV 2; // Round to nearest
assert 256 <= r && r < 512;
return r;
shared/functions/float/fpsqrt/FPSqrt
// FPSqrt()
// ========
assert N IN {16,32,64};
(fptype,sign,value) = FPUnpack(op, fpcr);
bits(N) result;
if fptype == FPType_SNaN || fptype == FPType_QNaN then
result = FPProcessNaN(fptype, op, fpcr);
elsif fptype == FPType_Zero then
result = FPZero(sign);
elsif fptype == FPType_Infinity && sign == '0' then
result = FPInfinity(sign);
elsif sign == '1' then
result = FPDefaultNaN();
FPProcessException(FPExc_InvalidOp, fpcr);
else
result = FPRound(Sqrt(value), fpcr);
return result;
shared/functions/float/fpsub/FPSub
// FPSub()
// =======
assert N IN {16,32,64};
rounding = FPRoundingMode(fpcr);
I1-516 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
elsif (inf1 && sign1 == '1') || (inf2 && sign2 == '0') then
result = FPInfinity('1');
elsif zero1 && zero2 && sign1 == NOT(sign2) then
result = FPZero(sign1);
else
result_value = value1 - value2;
if result_value == 0.0 then // Sign of exact zero result depends on rounding mode
result_sign = if rounding == FPRounding_NEGINF then '1' else '0';
result = FPZero(result_sign);
else
result = FPRound(result_value, fpcr, rounding);
return result;
shared/functions/float/fpthree/FPThree
// FPThree()
// =========
assert N IN {16,32,64};
constant integer E = (if N == 16 then 5 elsif N == 32 then 8 else 11);
constant integer F = N - (E + 1);
exp = '1':Zeros(E-1);
frac = '1':Zeros(F-1);
result = sign : exp : frac;
return result;
shared/functions/float/fptofixed/FPToFixed
// FPToFixed()
// ===========
// Convert N-bit precision floating point 'op' to M-bit fixed point with
// FBITS fractional bits, controlled by UNSIGNED and ROUNDING.
bits(M) FPToFixed(bits(N) op, integer fbits, boolean unsigned, FPCRType fpcr, FPRounding rounding)
assert N IN {16,32,64};
assert M IN {16,32,64};
assert fbits >= 0;
assert rounding != FPRounding_ODD;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-517
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
when FPRounding_NEGINF
round_up = FALSE;
when FPRounding_ZERO
round_up = (error != 0.0 && int_result < 0);
when FPRounding_TIEAWAY
round_up = (error > 0.5 || (error == 0.5 && int_result >= 0));
return result;
shared/functions/float/fptofixedjs/FPToFixedJS
// FPToFixedJS()
// =============
Z = '1';
// If NaN, set cumulative flag or take exception.
if fptype == FPType_SNaN || fptype == FPType_QNaN then
FPProcessException(FPExc_InvalidOp, fpcr);
Z = '0';
int_result = RoundDown(value);
error = value - Real(int_result);
integer result;
if int_result < 0 then
result = int_result - 2^32*RoundUp(Real(int_result)/Real(2^32));
else
result = int_result - 2^32*RoundDown(Real(int_result)/Real(2^32));
// Generate exceptions.
if int_result < -(2^31) || int_result > (2^31)-1 then
FPProcessException(FPExc_InvalidOp, fpcr);
Z = '0';
elsif error != 0.0 then
FPProcessException(FPExc_Inexact, fpcr);
Z = '0';
elsif sign == '1' && value == 0.0 then
Z = '0';
elsif sign == '0' && value == 0.0 && !IsZero(op<51:0>) then
Z = '0';
I1-518 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/float/fptwo/FPTwo
// FPTwo()
// =======
assert N IN {16,32,64};
constant integer E = (if N == 16 then 5 elsif N == 32 then 8 else 11);
constant integer F = N - (E + 1);
exp = '1':Zeros(E-1);
frac = Zeros(F);
result = sign : exp : frac;
return result;
shared/functions/float/fptype/FPType
enumeration FPType {FPType_Zero,
FPType_Denormal,
FPType_Nonzero,
FPType_Infinity,
FPType_QNaN,
FPType_SNaN};
shared/functions/float/fpunpack/FPUnpack
// FPUnpack()
// ==========
//
// Used by data processing and int/fixed <-> FP conversion instructions.
// For half-precision data it ignores AHP, and observes FZ16.
shared/functions/float/fpunpack/FPUnpackBase
// FPUnpackBase()
// ==============
//
// Unpack a floating-point number into its type, sign bit and the real number
// that it represents. The real number result has the correct sign for numbers
// and infinities, is very large in magnitude for infinities, and is 0.0 for
// NaNs. (These values are chosen to simplify the description of comparisons
// and conversions.)
//
// The 'fpcr_in' argument supplies FPCR control bits. Status information is
// updated directly in the FPSR where appropriate.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-519
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
real value;
bit sign;
FPType fptype;
if N == 16 then
sign = fpval<15>;
exp16 = fpval<14:10>;
frac16 = fpval<9:0>;
if IsZero(exp16) then
// Produce zero if value is zero or flush-to-zero is selected
if IsZero(frac16) || fpcr.FZ16 == '1' then
fptype = FPType_Zero; value = 0.0;
else
fptype = FPType_Denormal; value = 2.0^-14 * (Real(UInt(frac16)) * 2.0^-10);
elsif IsOnes(exp16) && fpcr.AHP == '0' then // Infinity or NaN in IEEE format
if IsZero(frac16) then
fptype = FPType_Infinity; value = 2.0^1000000;
else
fptype = if frac16<9> == '1' then FPType_QNaN else FPType_SNaN;
value = 0.0;
else
fptype = FPType_Nonzero;
value = 2.0^(UInt(exp16)-15) * (1.0 + Real(UInt(frac16)) * 2.0^-10);
elsif N == 32 then
sign = fpval<31>;
exp32 = fpval<30:23>;
frac32 = fpval<22:0>;
if IsZero(exp32) then
// Produce zero if value is zero or flush-to-zero is selected.
if IsZero(frac32) || fpcr.FZ == '1' then
fptype = FPType_Zero; value = 0.0;
if !IsZero(frac32) then // Denormalized input flushed to zero
FPProcessException(FPExc_InputDenorm, fpcr);
else
fptype = FPType_Denormal; value = 2.0^-126 * (Real(UInt(frac32)) * 2.0^-23);
elsif IsOnes(exp32) then
if IsZero(frac32) then
fptype = FPType_Infinity; value = 2.0^1000000;
else
fptype = if frac32<22> == '1' then FPType_QNaN else FPType_SNaN;
value = 0.0;
else
fptype = FPType_Nonzero;
value = 2.0^(UInt(exp32)-127) * (1.0 + Real(UInt(frac32)) * 2.0^-23);
else // N == 64
sign = fpval<63>;
exp64 = fpval<62:52>;
frac64 = fpval<51:0>;
if IsZero(exp64) then
// Produce zero if value is zero or flush-to-zero is selected.
if IsZero(frac64) || fpcr.FZ == '1' then
fptype = FPType_Zero; value = 0.0;
if !IsZero(frac64) then // Denormalized input flushed to zero
FPProcessException(FPExc_InputDenorm, fpcr);
else
fptype = FPType_Denormal; value = 2.0^-1022 * (Real(UInt(frac64)) * 2.0^-52);
elsif IsOnes(exp64) then
if IsZero(frac64) then
fptype = FPType_Infinity; value = 2.0^1000000;
else
fptype = if frac64<51> == '1' then FPType_QNaN else FPType_SNaN;
value = 0.0;
else
fptype = FPType_Nonzero;
I1-520 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/float/fpunpack/FPUnpackCV
// FPUnpackCV()
// ============
//
// Used for FP <-> FP conversion instructions.
// For half-precision data ignores FZ16 and observes AHP.
shared/functions/float/fpzero/FPZero
// FPZero()
// ========
assert N IN {16,32,64};
constant integer E = (if N == 16 then 5 elsif N == 32 then 8 else 11);
constant integer F = N - (E + 1);
exp = Zeros(E);
frac = Zeros(F);
result = sign : exp : frac;
return result;
shared/functions/float/vfpexpandimm/VFPExpandImm
// VFPExpandImm()
// ==============
assert N IN {16,32,64};
constant integer E = (if N == 16 then 5 elsif N == 32 then 8 else 11);
constant integer F = (N - E) - 1;
sign = imm8<7>;
exp = NOT(imm8<6>):Replicate(imm8<6>,E-3):imm8<5:4>;
frac = imm8<3:0>:Zeros(F-4);
result = sign : exp : frac;
return result;
shared/functions/integer/AddWithCarry
// AddWithCarry()
// ==============
// Integer addition with carry input, returning result and NZCV flags
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-521
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/interrupts/InterruptID
enumeration InterruptID {
InterruptID_PMUIRQ,
InterruptID_COMMIRQ,
InterruptID_CTIIRQ,
InterruptID_COMMRX,
InterruptID_COMMTX,
InterruptID_CNTP,
InterruptID_CNTHP,
InterruptID_CNTHPS,
InterruptID_CNTPS,
InterruptID_CNTV,
InterruptID_CNTHV,
InterruptID_CNTHVS,
};
shared/functions/interrupts/SetInterruptRequestLevel
// Set a level-sensitive interrupt to the specified level.
SetInterruptRequestLevel(InterruptID id, signal level);
shared/functions/memory/AArch64.BranchAddr
// AArch64.BranchAddr()
// ====================
// Return the virtual address with tag bits removed for storing to the program counter.
shared/functions/memory/AccType
enumeration AccType {AccType_NORMAL, // Normal loads and stores
AccType_STREAM, // Streaming loads and stores
AccType_VEC, // Vector loads and stores
AccType_VECSTREAM, // Streaming vector loads and stores
AccType_A32LSMD, // Load and store multiple
AccType_ATOMIC, // Atomic loads and stores
AccType_ATOMICRW,
AccType_ORDERED, // Load-Acquire and Store-Release
AccType_ORDEREDRW,
AccType_ORDEREDATOMIC, // Load-Acquire and Store-Release with atomic access
AccType_ORDEREDATOMICRW,
AccType_UNPRIV, // Load and store unprivileged
AccType_IFETCH, // Instruction fetch
I1-522 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/memory/AccessDescriptor
type AccessDescriptor is (
AccType acctype)
shared/functions/memory/AddrTop
// AddrTop()
// =========
// Return the MSB number of a virtual address in the stage 1 translation regime for "el".
// If EL1 is using AArch64 then addresses from EL0 using AArch32 are zero-extended to 64 bits.
shared/functions/memory/Allocation
constant bits(2) MemHint_No = '00'; // No Read-Allocate, No Write-Allocate
constant bits(2) MemHint_WA = '01'; // No Read-Allocate, Write-Allocate
constant bits(2) MemHint_RA = '10'; // Read-Allocate, No Write-Allocate
constant bits(2) MemHint_RWA = '11'; // Read-Allocate, Write-Allocate
shared/functions/memory/BigEndian
// BigEndian()
// ===========
if UsingAArch32() then
bigend = (PSTATE.E != '0');
elsif PSTATE.EL == EL0 then
bigend = (SCTLR[].E0E != '0');
else
bigend = (SCTLR[].EE != '0');
return bigend;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-523
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/memory/BigEndianReverse
// BigEndianReverse()
// ==================
shared/functions/memory/Cacheability
constant bits(2) MemAttr_NC = '00'; // Non-cacheable
constant bits(2) MemAttr_WT = '10'; // Write-through
constant bits(2) MemAttr_WB = '11'; // Write-back
shared/functions/memory/CreateAccessDescriptor
// CreateAccessDescriptor()
// ========================
shared/functions/memory/DataMemoryBarrier
DataMemoryBarrier(MBReqDomain domain, MBReqTypes types, boolean vmid_sensitive);
shared/functions/memory/DataSynchronizationBarrier
DataSynchronizationBarrier(MBReqDomain domain, MBReqTypes types, boolean vmid_sensitive);
shared/functions/memory/DeviceType
enumeration DeviceType {DeviceType_GRE, DeviceType_nGRE, DeviceType_nGnRE, DeviceType_nGnRnE};
shared/functions/memory/EffectiveTBI
// EffectiveTBI()
// ==============
// Returns the effective TBI in the AArch64 stage 1 translation regime for "el".
case regime of
when Regime_EL2
tbi = TCR_EL2.TBI;
tbid = TCR_EL2.TBID;
when Regime_EL10
if AArch64.GetVARange(address) == VARange_LOWER then
I1-524 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
tbi = TCR_EL1.TBI0;
tbid = TCR_EL1.TBID0;
else
tbi = TCR_EL1.TBI1;
tbid = TCR_EL1.TBID1;
return (if tbi == '1' && (!HavePACExt() || tbid == '0' || !IsInstr) then '1' else '0');
shared/functions/memory/Fault
enumeration Fault {Fault_None,
Fault_AccessFlag,
Fault_Alignment,
Fault_Background,
Fault_Domain,
Fault_Permission,
Fault_Translation,
Fault_AddressSize,
Fault_SyncExternal,
Fault_SyncExternalOnWalk,
Fault_SyncParity,
Fault_SyncParityOnWalk,
Fault_AsyncParity,
Fault_AsyncExternal,
Fault_Debug,
Fault_TLBConflict,
Fault_HWUpdateAccessFlag,
Fault_Lockdown,
Fault_Exclusive,
Fault_ICacheMaint};
shared/functions/memory/FaultRecord
type FaultRecord is (Fault statuscode, // Fault Status
AccType acctype, // Type of access that faulted
FullAddress ipaddress, // Intermediate physical address
boolean s2fs1walk, // Is on a Stage 1 translation table walk
boolean write, // TRUE for a write, FALSE for a read
integer level, // For translation, access flag and Permission faults
bit extflag, // IMPLEMENTATION DEFINED syndrome for External aborts
boolean secondstage, // Is a Stage 2 abort
bits(4) domain, // Domain number, AArch32 only
bits(2) errortype, // [Armv8.2 RAS] AArch32 AET or AArch64 SET
bits(4) debugmoe) // Debug method of entry, from AArch32 only
shared/functions/memory/FullAddress
type FullAddress is (
PASpace paspace,
bits(52) address
)
shared/functions/memory/Hint_Prefetch
// Signals the memory system that memory accesses of type HINT to or from the specified address are
// likely in the near future. The memory system may take some action to speed up the memory
// accesses when they do occur, such as pre-loading the the specified address into one or more
// caches as indicated by the innermost cache level target (0=L1, 1=L2, etc) and non-temporal hint
// stream. Any or all prefetch hints may be treated as a NOP. A prefetch hint must not cause a
// synchronous abort due to Alignment or Translation faults and the like. Its only effect on
// software-visible state should be on caches and TLBs associated with address, which must be
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-525
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// accessible by reads, writes or execution, as defined in the translation regime of the current
// Exception level. It is guaranteed not to access Device memory.
// A Prefetch_EXEC hint must not result in an access that could not be performed by a speculative
// instruction fetch, therefore if all associated MMUs are disabled, then it cannot access any
// memory location that cannot be accessed by instruction fetches.
Hint_Prefetch(bits(64) address, PrefetchHint hint, integer target, boolean stream);
shared/functions/memory/IsDataAccess
// IsDataAccess()
// ==============
// Return TRUE if access is to data memory.
shared/functions/memory/MBReqDomain
enumeration MBReqDomain {MBReqDomain_Nonshareable, MBReqDomain_InnerShareable,
MBReqDomain_OuterShareable, MBReqDomain_FullSystem};
shared/functions/memory/MBReqTypes
enumeration MBReqTypes {MBReqTypes_Reads, MBReqTypes_Writes, MBReqTypes_All};
shared/functions/memory/MPURecord
type MPURecord is (
bit CnP, // [Armv8.2] TLB entry can be shared between different PEs
Permissions permissions,
MemoryAttributes memattrs,
PASpace paspace
)
shared/functions/memory/MemAttrHints
type MemAttrHints is (
bits(2) attrs, // See MemAttr_*, Cacheability attributes
bits(2) hints, // See MemHint_*, Allocation hints
boolean transient
)
shared/functions/memory/MemType
enumeration MemType {MemType_Normal, MemType_Device};
shared/functions/memory/MemoryAttributes
type MemoryAttributes is (
MemType memtype,
DeviceType device, // For Device memory types
MemAttrHints inner, // Inner hints and attributes
MemAttrHints outer, // Outer hints and attributes
I1-526 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/memory/PASpace
enumeration PASpace {
PAS_NonSecure,
PAS_Secure,
};
shared/functions/memory/Permissions
type Permissions is (
bits(2) ap_table, // Stage 1 hierarchical access permissions
bit xn_table, // Stage 1 hierarchical execute-never for single EL regimes
bit pxn_table, // Stage 1 hierarchical privileged execute-never
bit uxn_table, // Stage 1 hierarchical unprivileged execute-never
bits(3) ap, // Stage 1 access permissions
bit xn, // Stage 1 execute-never for single EL regimes
bit uxn, // Stage 1 unprivileged execute-never
bit pxn, // Stage 1 privileged execute-never
bits(2) s2ap, // Stage 2 access permissions
bit s2xnx, // Stage 2 extended execute-never
bit s2xn // Stage 2 execute-never
)
shared/functions/memory/PhysMemRead
// Returns the value read from memory, and a status.
// Returned value is UNKNOWN if an External abort occurred while reading the
// memory.
// Otherwise the PhysMemRetStatus statuscode is Fault_None.
(PhysMemRetStatus, bits(8*size)) PhysMemRead(AddressDescriptor desc, integer size,
AccessDescriptor accdesc);
shared/functions/memory/PhysMemRetStatus
type PhysMemRetStatus is (Fault statuscode, // Fault Status
bit extflag, // IMPLEMENTATION DEFINED
// syndrome for External aborts
bits(2) errortype, // optional error state
// returned on a physical
// memory access
AccType acctype) // Type of access that faulted
shared/functions/memory/PhysMemWrite
// Writes the value to memory, and returns the status of the write.
// If there is an External abort on the write, the PhysMemRetStatus indicates this.
// Otherwise the statuscode of PhysMemRetStatus is Fault_None.
PhysMemRetStatus PhysMemWrite(AddressDescriptor desc, integer size, AccessDescriptor accdesc,
bits(8*size) value);
shared/functions/memory/PrefetchHint
enumeration PrefetchHint {Prefetch_READ, Prefetch_WRITE, Prefetch_EXEC};
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-527
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/memory/Shareability
enumeration Shareability {
Shareability_NSH,
Shareability_ISH,
Shareability_OSH
};
shared/functions/memory/SpeculativeStoreBypassBarrierToPA
SpeculativeStoreBypassBarrierToPA();
shared/functions/memory/SpeculativeStoreBypassBarrierToVA
SpeculativeStoreBypassBarrierToVA();
shared/functions/predictionrestrict/ASID
// ASID[]
// ======
// Effective ASID.
bits(16) ASID[]
if TCR_EL1.A1 == '1' then
return TTBR1_EL1.ASID;
else
return TTBR0_EL1.ASID;
shared/functions/predictionrestrict/ExecutionCntxt
type ExecutionCntxt is (
boolean is_vmid_valid, // is vmid valid for current context
boolean all_vmid, // should the operation be applied for all vmids
bits(16) vmid, // if all_vmid = FALSE, vmid to which operation is applied
boolean is_asid_valid, // is asid valid for current context
boolean all_asid, // should the operation be applied for all asids
bits(16) asid, // if all_asid = FALSE, ASID to which operation is applied
bits(2) target_el, // target EL at which operation is performed
SecurityState security,
RestrictType restriction // type of restriction operation
)
shared/functions/predictionrestrict/RESTRICT_PREDICTIONS
// RESTRICT_PREDICTIONS()
// ======================
// Clear all speculated values.
RESTRICT_PREDICTIONS(ExecutionCntxt c)
IMPLEMENTATION_DEFINED;
shared/functions/predictionrestrict/RestrictType
enumeration RestrictType {
RestrictType_DataValue,
RestrictType_ControlFlow,
I1-528 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
RestrictType_CachePrefetch
};
shared/functions/predictionrestrict/TargetSecurityState
// TargetSecurityState()
// =====================
// Decode the target security state for the prediction context.
shared/functions/registers/BranchTo
// BranchTo()
// ==========
// Set program counter to a new address, with a branch type.
// Parameter branch_conditional indicates whether the executed branch has a conditional encoding.
// In AArch64 state the address might include a tag in the top eight bits.
_PC = target_vaddress;
return;
shared/functions/registers/BranchToAddr
// BranchToAddr()
// ==============
// Set program counter to a new address, with a branch type.
// In AArch64 state the address does not include a tag in the top eight bits.
shared/functions/registers/BranchType
enumeration BranchType {
BranchType_DIRCALL, // Direct Branch with link
BranchType_INDCALL, // Indirect Branch with link
BranchType_ERET, // Exception return (indirect)
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-529
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/registers/Hint_Branch
// Report the hint passed to BranchTo() and BranchToAddr(), for consideration when processing
// the next instruction.
Hint_Branch(BranchType hint);
shared/functions/registers/NextInstrAddr
// Return address of the sequentially next instruction.
bits(N) NextInstrAddr();
shared/functions/registers/ResetExternalDebugRegisters
// Reset the External Debug registers in the Core power domain.
ResetExternalDebugRegisters(boolean cold_reset);
shared/functions/registers/ThisInstrAddr
// ThisInstrAddr()
// ===============
// Return address of the current instruction.
bits(N) ThisInstrAddr()
assert N == 64 || (N == 32 && UsingAArch32());
return _PC<N-1:0>;
shared/functions/registers/_PC
bits(64) _PC;
shared/functions/registers/_R
array bits(64) _R[0..30];
shared/functions/registers/_V
array bits(128) _V[0..31];
shared/functions/sysregisters/SPSR
// SPSR[] - non-assignment form
// ============================
bits(N) SPSR[]
bits(N) result;
if UsingAArch32() then
I1-530 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
assert N == 32;
case PSTATE.M of
when M32_FIQ result = SPSR_fiq<N-1:0>;
when M32_IRQ result = SPSR_irq<N-1:0>;
when M32_Svc result = SPSR_svc<N-1:0>;
when M32_Monitor result = SPSR_mon<N-1:0>;
when M32_Abort result = SPSR_abt<N-1:0>;
when M32_Hyp result = SPSR_hyp<N-1:0>;
when M32_Undef result = SPSR_und<N-1:0>;
otherwise Unreachable();
else
assert N == 64;
case PSTATE.EL of
when EL1 result = SPSR_EL1<N-1:0>;
when EL2 result = SPSR_EL2<N-1:0>;
when EL3 result = SPSR_EL3<N-1:0>;
otherwise Unreachable();
return result;
shared/functions/system/ArchVersion
enumeration ArchVersion {
ARMv8p0
, ARMv8p1
, ARMv8p2
, ARMv8p3
, ARMv8p4
, ARMv8p5
};
shared/functions/system/ClearEventRegister
// ClearEventRegister()
// ====================
// Clear the Event Register of this PE.
ClearEventRegister()
EventRegister = '0';
return;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-531
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/ClearPendingPhysicalSError
// Clear a pending physical SError interrupt.
ClearPendingPhysicalSError();
shared/functions/system/ClearPendingVirtualSError
// Clear a pending virtual SError interrupt.
ClearPendingVirtualSError();
shared/functions/system/ConditionHolds
// ConditionHolds()
// ================
// Return TRUE iff COND currently holds
return result;
shared/functions/system/ConsumptionOfSpeculativeDataBarrier
ConsumptionOfSpeculativeDataBarrier();
shared/functions/system/CurrentInstrSet
// CurrentInstrSet()
// =================
InstrSet CurrentInstrSet()
InstrSet result;
if UsingAArch32() then
result = if PSTATE.T == '0' then InstrSet_A32 else InstrSet_T32;
// PSTATE.J is RES0. Implementation of T32EE or Jazelle state not permitted.
else
result = InstrSet_A64;
return result;
shared/functions/system/CurrentPL
// CurrentPL()
// ===========
I1-532 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
PrivilegeLevel CurrentPL()
return PLOfEL(PSTATE.EL);
shared/functions/system/CurrentSecurityState
// CurrentSecurityState()
// ======================
// Returns the effective security state at the exception level based off current settings.
SecurityState CurrentSecurityState()
// V8R64 is always in Secure state
return SS_Secure;
shared/functions/system/EL0
constant bits(2) EL3 = '11';
constant bits(2) EL2 = '10';
constant bits(2) EL1 = '01';
constant bits(2) EL0 = '00';
shared/functions/system/EL2Enabled
// EL2Enabled()
// ============
// Returns TRUE if EL2 is present and executing
// - with the PE in Non-secure state when Non-secure EL2 is implemented, or
// - with the PE in Secure state when Secure EL2 is implemented and enabled, or
// - when EL3 is not implemented.
boolean EL2Enabled()
return TRUE;
shared/functions/system/EL3SDDTrapPriority
// EL3SDDTrapPriority()
// ====================
// Returns TRUE if in Debug state, EDSCR.SDD is set, and an EL3 trap by an
// EL3 control register has the priority of the original trap exception.
boolean EL3SDDTrapPriority()
return (Halted() && EDSCR.SDD == '1' &&
boolean IMPLEMENTATION_DEFINED "EL3 trap priority when SDD == '1'");
shared/functions/system/ELFromM32
// ELFromM32()
// ===========
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-533
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
when M32_Hyp
el = EL2;
valid = valid && (!HaveEL(EL3) || SCR_GEN[].NS == '1');
when M32_FIQ, M32_IRQ, M32_Svc, M32_Abort, M32_Undef, M32_System
// If EL3 is implemented and using AArch32, then these modes are EL3 modes in Secure
// state, and EL1 modes in Non-secure state. If EL3 is not implemented or is using
// AArch64, then these modes are EL1 modes.
el = (if HaveEL(EL3) && !HaveAArch64() && SCR.NS == '0' then EL3 else EL1);
when M32_User
el = EL0;
otherwise
valid = FALSE; // Passed an illegal mode value
if !valid then el = bits(2) UNKNOWN;
return (valid, el);
shared/functions/system/ELFromSPSR
// ELFromSPSR()
// ============
shared/functions/system/ELUsingAArch32
// ELUsingAArch32()
// ================
shared/functions/system/ELUsingAArch32K
// ELUsingAArch32K()
// =================
I1-534 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/EffectiveTGE
// EffectiveTGE()
// ==============
// Returns effective TGE value
bit EffectiveTGE()
if EL2Enabled() then
return if ELUsingAArch32(EL2) then HCR.TGE else HCR_EL2.TGE;
else
return '0'; // Effective value of TGE is zero
shared/functions/system/EndOfInstruction
// Terminate processing of the current instruction.
EndOfInstruction();
shared/functions/system/EnterLowPowerState
// PE enters a low-power state.
EnterLowPowerState();
shared/functions/system/EventRegister
bits(1) EventRegister;
shared/functions/system/ExceptionalOccurrenceTargetState
enumeration ExceptionalOccurrenceTargetState {
AArch32_NonDebugState,
AArch64_NonDebugState,
DebugState
};
shared/functions/system/FIQPending
// Returns TRUE if there is any pending physical FIQ.
boolean FIQPending();
shared/functions/system/GetAccumulatedFPExceptions
// Returns FP exceptions accumulated by the PE.
bits(8) GetAccumulatedFPExceptions();
shared/functions/system/GetPSRFromPSTATE
// GetPSRFromPSTATE()
// ==================
// Return a PSR value which represents the current PSTATE
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-535
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/HasArchVersion
// HasArchVersion()
// ================
// Returns TRUE if the implemented architecture includes the extensions defined in the specified
// architecture version.
shared/functions/system/HaveAArch32
// HaveAArch32()
// =============
// Return TRUE if AArch32 state is supported at at least EL0.
boolean HaveAArch32()
return boolean IMPLEMENTATION_DEFINED "AArch32 state is supported at at least EL0";
shared/functions/system/HaveAArch32EL
// HaveAArch32EL()
// ===============
I1-536 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
if !HaveEL(el) then
return FALSE; // The Exception level is not implemented
elsif !HaveAArch32() then
return FALSE; // No Exception level can use AArch32
elsif !HaveAArch64() then
return TRUE; // All Exception levels are using AArch32
elsif el == HighestEL() then
return FALSE; // The highest Exception level is using AArch64
elsif el == EL0 then
return TRUE; // EL0 must support using AArch32 if any AArch32
return boolean IMPLEMENTATION_DEFINED;
shared/functions/system/HaveAArch64
// HaveAArch64()
// =============
// Return TRUE if the highest Exception level is using AArch64 state.
boolean HaveAArch64()
return boolean IMPLEMENTATION_DEFINED "Highest EL using AArch64";
shared/functions/system/HaveEL
// HaveEL()
// ========
// Return TRUE if Exception level 'el' is supported
shared/functions/system/HaveELUsingSecurityState
// HaveELUsingSecurityState()
// ==========================
// Returns TRUE if Exception level 'el' with Security state 'secure' is supported,
// FALSE otherwise.
case el of
when EL3
assert secure;
return HaveEL(EL3);
when EL2
if secure then
return HaveEL(EL2) && HaveSecureEL2Ext();
else
return HaveEL(EL2);
otherwise
return (HaveEL(EL3) ||
(secure == boolean IMPLEMENTATION_DEFINED "Secure-only implementation"));
shared/functions/system/HaveFP16Ext
// HaveFP16Ext()
// =============
// Return TRUE if FP16 extension is supported
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-537
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
boolean HaveFP16Ext()
return boolean IMPLEMENTATION_DEFINED;
shared/functions/system/HighestEL
// HighestEL()
// ===========
// Returns the highest implemented Exception level.
bits(2) HighestEL()
if HaveEL(EL3) then
return EL3;
elsif HaveEL(EL2) then
return EL2;
else
return EL1;
shared/functions/system/Hint_DGH
// Provides a hint to close any gathering occurring within the micro-architecture.
Hint_DGH();
shared/functions/system/Hint_WFE
// Hint_WFE()
// ==========
// Provides a hint indicating that the PE can enter a low-power state and
// remain there until a wakeup event occurs.
Hint_WFE(WFxType wfxtype)
if IsEventRegisterSet() then
ClearEventRegister();
else
if PSTATE.EL == EL0 then
// Check for traps described by the OS.
AArch64.CheckForWFxTrap(EL1, wfxtype);
if PSTATE.EL IN {EL0, EL1} && EL2Enabled() then
// Check for traps described by the Hypervisor.
AArch64.CheckForWFxTrap(EL2, wfxtype);
if HaveEL(EL3) && PSTATE.EL != EL3 then
// Check for traps described by the Secure Monitor.
AArch64.CheckForWFxTrap(EL3, wfxtype);
WaitForEvent();
shared/functions/system/Hint_WFI
// Hint_WFI()
// ==========
// Provides a hint indicating that the PE can enter a low-power state and
// remain there until a wakeup event occurs.
Hint_WFI(WFxType wfxtype)
if InterruptPending() then
// No further operation if an interrupt is pending.
EndOfInstruction();
else
if PSTATE.EL == EL0 then
// Check for traps described by the OS.
AArch64.CheckForWFxTrap(EL1, wfxtype);
if PSTATE.EL IN {EL0, EL1} && EL2Enabled() then
// Check for traps described by the Hypervisor.
I1-538 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
AArch64.CheckForWFxTrap(EL2, wfxtype);
if HaveEL(EL3) && PSTATE.EL != EL3 then
// Check for traps described by the Secure Monitor.
AArch64.CheckForWFxTrap(EL3, wfxtype);
WaitForInterrupt();
shared/functions/system/Hint_Yield
// Provides a hint that the task performed by a thread is of low
// importance so that it could yield to improve overall performance.
Hint_Yield();
shared/functions/system/IRQPending
// Returns TRUE if there is any pending physical IRQ.
boolean IRQPending();
shared/functions/system/IllegalExceptionReturn
// IllegalExceptionReturn()
// ========================
// Check for illegal return to EL1 when HCR.TGE is set and when either of
// * SecureEL2 is enabled.
// * SecureEL2 is not enabled and EL1 is in Non-secure state.
if HaveEL(EL2) && target == EL1 && HCR_EL2.TGE == '1' then
if (!IsSecureBelowEL3() || IsSecureEL2Enabled()) then return TRUE;
return FALSE;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-539
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/InstrSet
enumeration InstrSet {InstrSet_A64, InstrSet_A32, InstrSet_T32};
shared/functions/system/InstructionSynchronizationBarrier
InstructionSynchronizationBarrier(boolean vmid_sensitive);
shared/functions/system/InterruptPending
// InterruptPending()
// ==================
// Returns TRUE if there are any pending physical or virtual
// interrupts, and FALSE otherwise.
boolean InterruptPending()
boolean pending_virtual_interrupt = FALSE;
boolean pending_physical_interrupt = (IRQPending() || FIQPending() ||
IsPhysicalSErrorPending());
shared/functions/system/IsASEInstruction
// Returns TRUE if the current instruction is an ASIMD or SVE vector instruction.
boolean IsASEInstruction();
shared/functions/system/IsCurrentSecurityState
// IsCurrentSecurityState()
// ========================
// Returns TRUE if the current Security state matches
// the given Security state, and FALSE otherwise.
shared/functions/system/IsEventRegisterSet
// IsEventRegisterSet()
// ====================
// Return TRUE if the Event Register of this PE is set, and FALSE if it is clear.
boolean IsEventRegisterSet()
return EventRegister == '1';
shared/functions/system/IsHighestEL
// IsHighestEL()
// =============
// Returns TRUE if given exception level is the highest exception level implemented
I1-540 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/IsPhysicalSErrorPending
// Returns TRUE if a physical SError interrupt is pending.
boolean IsPhysicalSErrorPending();
shared/functions/system/IsSErrorEdgeTriggered
// IsSErrorEdgeTriggered()
// =======================
// Returns TRUE if the physical SError interrupt is edge-triggered
// and FALSE otherwise.
shared/functions/system/IsSecure
// IsSecure()
// ==========
// Returns TRUE if current Exception level is in Secure state.
boolean IsSecure()
if HaveEL(EL3) && !UsingAArch32() && PSTATE.EL == EL3 then
return TRUE;
elsif HaveEL(EL3) && UsingAArch32() && PSTATE.M == M32_Monitor then
return TRUE;
return IsSecureBelowEL3();
return TRUE;
shared/functions/system/IsSecureBelowEL3
// IsSecureBelowEL3()
// ==================
// Return TRUE if an Exception level below EL3 is in Secure state
// or would be following an exception return to that level.
//
// Differs from IsSecure in that it ignores the current EL or Mode
// in considering security state.
// That is, if at AArch64 EL3 or in AArch32 Monitor mode, whether an
// exception return would pass to Secure or Non-secure state.
boolean IsSecureBelowEL3()
return TRUE;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-541
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/IsSecureEL2Enabled
// IsSecureEL2Enabled()
// ====================
// Returns TRUE if Secure EL2 is enabled, FALSE otherwise.
boolean IsSecureEL2Enabled()
return TRUE;
shared/functions/system/IsSynchronizablePhysicalSErrorPending
// Returns TRUE if a synchronizable physical SError interrupt is pending.
boolean IsSynchronizablePhysicalSErrorPending();
shared/functions/system/IsVirtualSErrorPending
// Returns TRUE if a virtual SError interrupt is pending.
boolean IsVirtualSErrorPending();
shared/functions/system/Mode_Bits
constant bits(5) M32_User = '10000';
constant bits(5) M32_FIQ = '10001';
constant bits(5) M32_IRQ = '10010';
constant bits(5) M32_Svc = '10011';
constant bits(5) M32_Monitor = '10110';
constant bits(5) M32_Abort = '10111';
constant bits(5) M32_Hyp = '11010';
constant bits(5) M32_Undef = '11011';
constant bits(5) M32_System = '11111';
shared/functions/system/NonSecureOnlyImplementation
// NonSecureOnlyImplementation()
// =============================
// Returns TRUE if the security state is always Non-secure for this implementation.
boolean NonSecureOnlyImplementation()
return boolean IMPLEMENTATION_DEFINED "Non-secure only implementation";
shared/functions/system/PLOfEL
// PLOfEL()
// ========
shared/functions/system/PSTATE
ProcState PSTATE;
I1-542 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/PhysicalCountInt
// PhysicalCountInt()
// ==================
// Returns the integral part of physical count value of the System counter.
bits(64) PhysicalCountInt()
return PhysicalCount<63:0>;
shared/functions/system/PrivilegeLevel
enumeration PrivilegeLevel {PL3, PL2, PL1, PL0};
shared/functions/system/ProcState
type ProcState is (
bits (1) N, // Negative condition flag
bits (1) Z, // Zero condition flag
bits (1) C, // Carry condition flag
bits (1) V, // Overflow condition flag
bits (1) D, // Debug mask bit [AArch64 only]
bits (1) A, // SError interrupt mask bit
bits (1) I, // IRQ mask bit
bits (1) F, // FIQ mask bit
bits (1) PAN, // Privileged Access Never Bit [v8.1]
bits (1) UAO, // User Access Override [v8.2]
bits (1) DIT, // Data Independent Timing [v8.4]
bits (1) SS, // Software step bit
bits (1) IL, // Illegal Execution state bit
bits (2) EL, // Exception level
bits (1) nRW, // not Register Width: 0=64, 1=32
bits (1) SP, // Stack pointer select: 0=SP0, 1=SPx [AArch64 only]
bits (1) Q, // Cumulative saturation flag [AArch32 only]
bits (4) GE, // Greater than or Equal flags [AArch32 only]
bits (1) SSBS, // Speculative Store Bypass Safe
bits (8) IT, // If-then bits, RES0 in CPSR [AArch32 only]
bits (1) J, // J bit, RES0 [AArch32 only, RES0 in SPSR and CPSR]
bits (1) T, // T32 bit, RES0 in CPSR [AArch32 only]
bits (1) E, // Endianness bit [AArch32 only]
bits (5) M // Mode field [AArch32 only]
)
shared/functions/system/RestoredITBits
// RestoredITBits()
// ================
// Get the value of PSTATE.IT to be restored on this exception return.
// When PSTATE.IL is set, it is CONSTRAINED UNPREDICTABLE whether the IT bits are each set
// to zero or copied from the SPSR.
if PSTATE.IL == '1' then
if ConstrainUnpredictableBool() then return '00000000';
else return it;
// The IT bits are forced to zero when they are set to a reserved value.
if !IsZero(it<7:4>) && IsZero(it<3:0>) then
return '00000000';
// The IT bits are forced to zero when returning to A32 state, or when returning to an EL
// with the ITD bit set to 1, and the IT bits are describing a multi-instruction block.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-543
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/SecureOnlyImplementation
// SecureOnlyImplementation()
// ==========================
// Returns TRUE if the security state is always Secure for this implementation.
boolean SecureOnlyImplementation()
return boolean IMPLEMENTATION_DEFINED "Secure-only implementation";
shared/functions/system/SecurityState
enumeration SecurityState {
SS_NonSecure,
SS_Secure
};
shared/functions/system/SecurityStateAtEL
// SecurityStateAtEL()
// ===================
// Returns the effective security state at the exception level based off current settings.
shared/functions/system/SendEvent
// Signal an event to all PEs in a multiprocessor system to set their Event Registers.
// When a PE executes the SEV instruction, it causes this function to be executed.
SendEvent();
shared/functions/system/SendEventLocal
// SendEventLocal()
// ================
// Set the local Event Register of this PE.
// When a PE executes the SEVL instruction, it causes this function to be executed.
SendEventLocal()
EventRegister = '1';
return;
shared/functions/system/SetAccumulatedFPExceptions
// Stores FP Exceptions accumulated by the PE.
SetAccumulatedFPExceptions(bits(8) accumulated_exceptions);
I1-544 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/SetPSTATEFromPSR
// SetPSTATEFromPSR()
// ==================
SetPSTATEFromPSR(bits(N) spsr)
boolean illegal_psr_state = IllegalExceptionReturn(spsr);
SetPSTATEFromPSR(spsr, illegal_psr_state);
// SetPSTATEFromPSR()
// ==================
// Set PSTATE based on a PSR value
shared/functions/system/ShouldAdvanceIT
boolean ShouldAdvanceIT;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-545
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/ShouldAdvanceSS
boolean ShouldAdvanceSS;
shared/functions/system/SpeculationBarrier
SpeculationBarrier();
shared/functions/system/SynchronizeContext
SynchronizeContext();
shared/functions/system/SynchronizeErrors
// Implements the error synchronization event.
SynchronizeErrors();
shared/functions/system/TakeUnmaskedPhysicalSErrorInterrupts
// Take any pending unmasked physical SError interrupt.
TakeUnmaskedPhysicalSErrorInterrupts(boolean iesb_req);
shared/functions/system/TakeUnmaskedSErrorInterrupts
// Take any pending unmasked physical SError interrupt or unmasked virtual SError
// interrupt.
TakeUnmaskedSErrorInterrupts();
shared/functions/system/ThisInstr
bits(32) ThisInstr();
shared/functions/system/ThisInstrLength
integer ThisInstrLength();
shared/functions/system/Unreachable
Unreachable()
assert FALSE;
shared/functions/system/UsingAArch32
// UsingAArch32()
// ==============
// Return TRUE if the current Exception level is using AArch32, FALSE if using AArch64.
boolean UsingAArch32()
boolean aarch32 = (PSTATE.nRW == '1');
if !HaveAArch32() then assert !aarch32;
I1-546 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/system/VirtualFIQPending
// Returns TRUE if there is any pending virtual FIQ.
boolean VirtualFIQPending();
shared/functions/system/VirtualIRQPending
// Returns TRUE if there is any pending virtual IRQ.
boolean VirtualIRQPending();
shared/functions/system/WFxType
enumeration WFxType {WFxType_WFE, WFxType_WFI};
shared/functions/system/WaitForEvent
// WaitForEvent()
// ==============
// PE optionally suspends execution until one of the following occurs:
// - A WFE wakeup event.
// - A reset.
// - The implementation chooses to resume execution.
// It is IMPLEMENTATION DEFINED whether restarting execution after the period of
// suspension causes the Event Register to be cleared.
WaitForEvent()
if !IsEventRegisterSet() then
EnterLowPowerState();
return;
shared/functions/system/WaitForInterrupt
// WaitForInterrupt()
// ==================
// PE optionally suspends execution until one of the following occurs:
// - A WFI wakeup event.
// - A reset.
// - The implementation chooses to resume execution.
WaitForInterrupt()
EnterLowPowerState();
return;
shared/functions/unpredictable/ConstrainUnpredictable
// ConstrainUnpredictable()
// ========================
// Return the appropriate Constraint result to control the caller's behavior. The return value
// is IMPLEMENTATION DEFINED within a permitted list for each UNPREDICTABLE case.
// (The permitted list is determined by an assert or case statement at the call site.)
// NOTE: This version of the function uses an Unpredictable argument to define the call site.
// This argument does not appear in the version used in the Armv8 Architecture Reference Manual.
// The extra argument is used here to allow this example definition. This is an example only and
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-547
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// does not imply a fixed implementation of these behaviors. Indeed the intention is that it should
// be defined by each implementation, according to its implementation choices.
I1-548 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
when Unpredictable_IGNORETRAPINDEBUG
return Constraint_TRUE; // Trap to register access in debug state is ignored
when Unpredictable_PMUEVENTCOUNTER
return Constraint_UNDEF; // Accesses to the register are UNDEFINED
shared/functions/unpredictable/ConstrainUnpredictableBits
// ConstrainUnpredictableBits()
// ============================
// NOTE: This version of the function uses an Unpredictable argument to define the call site.
// This argument does not appear in the version used in the Armv8 Architecture Reference Manual.
// See the NOTE on ConstrainUnpredictable() for more information.
// This is an example placeholder only and does not imply a fixed implementation of the bits part
// of the result, and may not be applicable in all cases.
c = ConstrainUnpredictable(which);
if c == Constraint_UNKNOWN then
return (c, Zeros(width)); // See notes; this is an example implementation only
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-549
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/unpredictable/ConstrainUnpredictableBool
// ConstrainUnpredictableBool()
// ============================
// This is a simple wrapper function for cases where the constrained result is either TRUE or FALSE.
// NOTE: This version of the function uses an Unpredictable argument to define the call site.
// This argument does not appear in the version used in the Armv8 Architecture Reference Manual.
// See the NOTE on ConstrainUnpredictable() for more information.
c = ConstrainUnpredictable(which);
assert c IN {Constraint_TRUE, Constraint_FALSE};
return (c == Constraint_TRUE);
shared/functions/unpredictable/ConstrainUnpredictableInteger
// ConstrainUnpredictableInteger()
// ===============================
// NOTE: This version of the function uses an Unpredictable argument to define the call site.
// This argument does not appear in the version used in the Armv8 Architecture Reference Manual.
// See the NOTE on ConstrainUnpredictable() for more information.
// This is an example placeholder only and does not imply a fixed implementation of the integer part
// of the result.
c = ConstrainUnpredictable(which);
if c == Constraint_UNKNOWN then
return (c, low); // See notes; this is an example implementation only
else
return (c, integer UNKNOWN); // integer result not used
shared/functions/unpredictable/Constraint
enumeration Constraint {// General
Constraint_NONE, // Instruction executes with
// no change or side-effect to its described
behavior
Constraint_UNKNOWN, // Destination register has UNKNOWN value
Constraint_UNDEF, // Instruction is UNDEFINED
Constraint_UNDEFEL0, // Instruction is UNDEFINED at EL0 only
Constraint_NOP, // Instruction executes as NOP
Constraint_TRUE,
Constraint_FALSE,
Constraint_DISABLED,
Constraint_UNCOND, // Instruction executes unconditionally
Constraint_COND, // Instruction executes conditionally
Constraint_ADDITIONAL_DECODE, // Instruction executes with additional decode
I1-550 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// Load-store
Constraint_WBSUPPRESS,
Constraint_FAULT,
Constraint_MPU_FAULT, // Raise MPU fault
Constraint_MPU_ATTR_UNKNOWN, // MPU Attribute is UNKNOWN
Constraint_OSH, // Constrain to Outer Shareable
Constraint_ISH, // Constrain to Inner Shareable
Constraint_NSH, // Constrain to Nonshareable
shared/functions/unpredictable/Unpredictable
enumeration Unpredictable {// VMSR on MVFR
Unpredictable_VMSR,
// Writeback/transfer register overlap (load)
Unpredictable_WBOVERLAPLD,
// Writeback/transfer register overlap (store)
Unpredictable_WBOVERLAPST,
// Load Pair transfer register overlap
Unpredictable_LDPOVERLAP,
// Store-exclusive base/status register overlap
Unpredictable_BASEOVERLAP,
// Store-exclusive data/status register overlap
Unpredictable_DATAOVERLAP,
// Load-store alignment checks
Unpredictable_DEVPAGE2,
// Instruction fetch from Device memory
Unpredictable_INSTRDEVICE,
// Reserved CPACR value
Unpredictable_RESCPACR,
// Reserved MAIR value
Unpredictable_RESMAIR,
// Reserved Stage 2 MemAttr value
Unpredictable_S2RESMEMATTR,
// Reserved TEX:C:B value
Unpredictable_RESTEXCB,
// Reserved PRRR value
Unpredictable_RESPRRR,
// Reserved DACR field
Unpredictable_RESDACR,
// Reserved VTCR.S value
Unpredictable_RESVTCRS,
// Reserved TCR.TnSZ value
Unpredictable_RESTnSZ,
// Out-of-range TCR.TnSZ value
Unpredictable_OORTnSZ,
// IPA size exceeds PA size
Unpredictable_LARGEIPA,
// Syndrome for a known-passing conditional A32 instruction
Unpredictable_ESRCONDPASS,
// Illegal State exception: zero PSTATE.IT
Unpredictable_ILZEROIT,
// Illegal State exception: zero PSTATE.T
Unpredictable_ILZEROT,
// Debug: prioritization of Vector Catch
Unpredictable_BPVECTORCATCHPRI,
// Debug Vector Catch: match on 2nd halfword
Unpredictable_VCMATCHHALF,
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-551
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
I1-552 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/vector/AdvSIMDExpandImm
// AdvSIMDExpandImm()
// ==================
return imm64;
shared/functions/vector/PolynomialMult
// PolynomialMult()
// ================
shared/functions/vector/SatQ
// SatQ()
// ======
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-553
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/vector/SignedSatQ
// SignedSatQ()
// ============
shared/functions/vector/UnsignedRSqrtEstimate
// UnsignedRSqrtEstimate()
// =======================
return result;
shared/functions/vector/UnsignedRecipEstimate
// UnsignedRecipEstimate()
// =======================
return result;
I1-554 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/functions/vector/UnsignedSatQ
// UnsignedSatQ()
// ==============
I1.2.4 shared/translation
This section includes the following pseudocode functions:
• shared/translation/at/ATAccess on page I1-556.
• shared/translation/at/EncodePARAttrs on page I1-556.
• shared/translation/at/PAREncodeShareability on page I1-557.
• shared/translation/at/TranslationStage on page I1-557.
• shared/translation/attrs/DecodeDevice on page I1-557.
• shared/translation/attrs/DecodeLDFAttr on page I1-557.
• shared/translation/attrs/DecodeSDFAttr on page I1-558.
• shared/translation/attrs/DecodeShareability on page I1-558.
• shared/translation/attrs/EffectiveShareability on page I1-558.
• shared/translation/attrs/MAIRAttr on page I1-559.
• shared/translation/attrs/NormalNCMemAttr on page I1-559.
• shared/translation/attrs/S1ConstrainUnpredictableRESMAIR on page I1-559.
• shared/translation/attrs/S1DecodeMemAttrs on page I1-559.
• shared/translation/attrs/S2CombineS1AttrHints on page I1-560.
• shared/translation/attrs/S2CombineS1Device on page I1-560.
• shared/translation/attrs/S2CombineS1MemAttrs on page I1-560.
• shared/translation/attrs/S2CombineS1Shareability on page I1-561.
• shared/translation/attrs/WalkMemAttrs on page I1-561.
• shared/translation/faults/AlignmentFault on page I1-561.
• shared/translation/faults/AsyncExternalAbort on page I1-562.
• shared/translation/faults/NoFault on page I1-562.
• shared/translation/translation/S1TranslationRegime on page I1-562.
• shared/translation/vmsa/AddressDescriptor on page I1-562.
• shared/translation/vmsa/ContiguousSize on page I1-563.
• shared/translation/vmsa/CreateAddressDescriptor on page I1-563.
• shared/translation/vmsa/CreateFaultyAddressDescriptor on page I1-563.
• shared/translation/vmsa/DescriptorType on page I1-563.
• shared/translation/vmsa/Domains on page I1-564.
• shared/translation/vmsa/FetchDescriptor on page I1-564.
• shared/translation/vmsa/HasUnprivileged on page I1-564.
• shared/translation/vmsa/IsAtomicRW on page I1-564.
• shared/translation/vmsa/Regime on page I1-565.
• shared/translation/vmsa/RegimeUsingAArch32 on page I1-565.
• shared/translation/vmsa/S1TTWParams on page I1-565.
• shared/translation/vmsa/SDFType on page I1-565.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-555
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/translation/at/ATAccess
enumeration ATAccess {
ATAccess_Read,
ATAccess_Write,
ATAccess_ReadPAN,
ATAccess_WritePAN
};
shared/translation/at/EncodePARAttrs
// EncodePARAttrs()
// ================
// Convert orthogonal attributes and hints to 64-bit PAR ATTR field.
I1-556 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
return result;
shared/translation/at/PAREncodeShareability
// PAREncodeShareability()
// =======================
// Derive 64-bit PAR SH field.
case memattrs.shareability of
when Shareability_NSH return '00';
when Shareability_ISH return '11';
when Shareability_OSH return '10';
shared/translation/at/TranslationStage
enumeration TranslationStage {
TranslationStage_1,
TranslationStage_12
};
shared/translation/attrs/DecodeDevice
// DecodeDevice()
// ==============
// Decode output Device type
shared/translation/attrs/DecodeLDFAttr
// DecodeLDFAttr()
// ===============
// Decode memory attributes using LDF (Long Descriptor Format) mapping
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-557
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
// The Transient hint applies only to cacheable memory with some allocation hints.
if ldfattr.attrs != MemAttr_NC && ldfattr.hints != MemHint_No then
ldfattr.transient = attr<3> == '0';
return ldfattr;
shared/translation/attrs/DecodeSDFAttr
// DecodeSDFAttr()
// ===============
// Decode memory attributes using SDF (Short Descriptor Format) mapping
case rgn of
when '00' // Non-cacheable (no allocate)
sdfattr.attrs = MemAttr_NC;
when '01' // Write-back, Read and Write allocate
sdfattr.attrs = MemAttr_WB;
sdfattr.hints = MemHint_RWA;
when '10' // Write-through, Read allocate
sdfattr.attrs = MemAttr_WT;
sdfattr.hints = MemHint_RA;
when '11' // Write-back, Read allocate
sdfattr.attrs = MemAttr_WB;
sdfattr.hints = MemHint_RA;
sdfattr.transient = FALSE;
return sdfattr;
shared/translation/attrs/DecodeShareability
// DecodeShareability()
// ====================
// Decode shareability of target memory region
shared/translation/attrs/EffectiveShareability
// EffectiveShareability()
// =======================
// Force Outer Shareability on Device and Normal iNCoNC memory
I1-558 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
else
return memattrs.shareability;
shared/translation/attrs/MAIRAttr
// MAIRAttr()
// ==========
// Retrieve the memory attribute encoding indexed in the given MAIR
shared/translation/attrs/NormalNCMemAttr
// NormalNCMemAttr()
// =================
// Normal Non-cacheable memory attributes
MemoryAttributes NormalNCMemAttr()
MemAttrHints non_cacheable;
non_cacheable.attrs = MemAttr_NC;
MemoryAttributes nc_memattrs;
nc_memattrs.memtype = MemType_Normal;
nc_memattrs.outer = non_cacheable;
nc_memattrs.inner = non_cacheable;
nc_memattrs.shareability = Shareability_OSH;
return nc_memattrs;
shared/translation/attrs/S1ConstrainUnpredictableRESMAIR
// S1ConstrainUnpredictableRESMAIR()
// =================================
// Determine whether a reserved value occupies MAIR_ELx.AttrN
shared/translation/attrs/S1DecodeMemAttrs
// S1DecodeMemAttrs()
// ==================
// Decode MAIR-format memory attributes assigned in stage 1
MemoryAttributes memattrs;
case attr of
when '0000xxxx' // Device memory
memattrs.memtype = MemType_Device;
memattrs.device = DecodeDevice(attr<3:2>);
otherwise
memattrs.memtype = MemType_Normal;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-559
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
memattrs.outer = DecodeLDFAttr(attr<7:4>);
memattrs.inner = DecodeLDFAttr(attr<3:0>);
memattrs.shareability = DecodeShareability(sh);
return memattrs;
shared/translation/attrs/S2CombineS1AttrHints
// S2CombineS1AttrHints()
// ======================
// Determine resultant Normal memory cacheability and allocation hints from
// combining stage 1 Normal memory attributes and stage 2 cacheability attributes.
return attrhints;
shared/translation/attrs/S2CombineS1Device
// S2CombineS1Device()
// ===================
// Determine resultant Device type from combining output memory attributes
// in stage 1 and Device attributes in stage 2
shared/translation/attrs/S2CombineS1MemAttrs
// S2CombineS1MemAttrs()
// =====================
// Combine stage 2 with stage 1 memory attributes
I1-560 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
memattrs = s1_memattrs;
elsif s2_memattrs.memtype == MemType_Device then // S2 Device, S1 Normal
memattrs = s2_memattrs;
else // S2 Normal, S1 Normal
memattrs.memtype = MemType_Normal;
memattrs.inner = S2CombineS1AttrHints(s1_memattrs.inner, s2_memattrs.inner);
memattrs.outer = S2CombineS1AttrHints(s1_memattrs.outer, s2_memattrs.outer);
memattrs.shareability = S2CombineS1Shareability(s1_memattrs.shareability,
s2_memattrs.shareability);
memattrs.shareability = EffectiveShareability(memattrs);
return memattrs;
shared/translation/attrs/S2CombineS1Shareability
// S2CombineS1Shareability()
// =========================
// Combine stage 2 shareability with stage 1
if (s1_shareability == Shareability_OSH ||
s2_shareability == Shareability_OSH) then
return Shareability_OSH;
elsif (s1_shareability == Shareability_ISH ||
s2_shareability == Shareability_ISH) then
return Shareability_ISH;
else
return Shareability_NSH;
shared/translation/attrs/WalkMemAttrs
// WalkMemAttrs()
// ==============
// Retrieve memory attributes of translation table walk
walkmemattrs.memtype = MemType_Normal;
walkmemattrs.shareability = DecodeShareability(sh);
walkmemattrs.inner = DecodeSDFAttr(irgn);
walkmemattrs.outer = DecodeSDFAttr(orgn);
return walkmemattrs;
shared/translation/faults/AlignmentFault
// AlignmentFault()
// ================
fault.statuscode = Fault_Alignment;
fault.acctype = acctype;
fault.write = iswrite;
fault.secondstage = secondstage;
return fault;
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-561
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/translation/faults/AsyncExternalAbort
// AsyncExternalAbort()
// ====================
// Return a fault record indicating an asynchronous External abort
return fault;
shared/translation/faults/NoFault
// NoFault()
// =========
// Return a clear fault record indicating no faults have occured
FaultRecord NoFault()
FaultRecord fault;
fault.statuscode = Fault_None;
fault.acctype = AccType_NORMAL;
fault.secondstage = FALSE;
fault.s2fs1walk = FALSE;
return fault;
shared/translation/translation/S1TranslationRegime
// S1TranslationRegime()
// =====================
// Stage 1 translation regime for the given Exception level
// S1TranslationRegime()
// =====================
// Returns the Exception level controlling the current Stage 1 translation regime. For the most
// part this is unused in code because the system register accessors (SCTLR[], etc.) implicitly
// return the correct value.
bits(2) S1TranslationRegime()
return S1TranslationRegime(PSTATE.EL);
shared/translation/vmsa/AddressDescriptor
type AddressDescriptor is (
FaultRecord fault, // fault.statuscode indicates whether the address is valid
MemoryAttributes memattrs,
FullAddress paddress,
bits(64) vaddress
)
I1-562 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/translation/vmsa/ContiguousSize
// ContiguousSize()
// ================
// Return the number of entries log 2 marking a contiguous output range
shared/translation/vmsa/CreateAddressDescriptor
// CreateAddressDescriptor()
// =========================
// Set internal members for address descriptor type to valid values
addrdesc.paddress = pa;
addrdesc.vaddress = va;
addrdesc.memattrs = memattrs;
addrdesc.fault = NoFault();
return addrdesc;
shared/translation/vmsa/CreateFaultyAddressDescriptor
// CreateFaultyAddressDescriptor()
// ===============================
// Set internal members for address descriptor type with values indicating error
addrdesc.vaddress = va;
addrdesc.fault = fault;
return addrdesc;
shared/translation/vmsa/DescriptorType
enumeration DescriptorType {
DescriptorType_Table,
DescriptorType_Block,
DescriptorType_Page,
DescriptorType_Invalid
};
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-563
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/translation/vmsa/Domains
constant bits(2) Domain_NoAccess = '00';
constant bits(2) Domain_Client = '01';
constant bits(2) Domain_Manager = '11';
shared/translation/vmsa/FetchDescriptor
// FetchDescriptor()
// =================
// Fetch a translation table descriptor
walkacc.acctype = AccType_TTW;
PhysMemRetStatus memstatus;
(memstatus, descriptor) = PhysMemRead(walkaddress, N DIV 8, walkacc);
if IsFault(memstatus) then
fault = HandleExternalTTWAbort(memstatus, fault.write, walkaddress,
walkacc, N DIV 8, fault);
if IsFault(fault.statuscode) then
return (fault, bits(N) UNKNOWN);
if ee == '1' then
descriptor = BigEndianReverse(descriptor);
shared/translation/vmsa/HasUnprivileged
// HasUnprivileged()
// =================
// Returns whether a translation regime serves EL0 as well as a higher EL
shared/translation/vmsa/IsAtomicRW
// IsAtomicRW()
// ============
// Is the access an atomic operation?
I1-564 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/translation/vmsa/Regime
enumeration Regime {
Regime_EL2, // EL2
Regime_EL10 // EL1&0
};
shared/translation/vmsa/RegimeUsingAArch32
// RegimeUsingAArch32()
// ====================
// Determine if the EL controlling the regime executes in AArch32 state
shared/translation/vmsa/S1TTWParams
type S1TTWParams is (
// A64-VMSA exclusive parameters
bit ha, // TCR_ELx.HA
bit hd, // TCR_ELx.HD
bit tbi, // TCR_ELx.TBI{x}
bit tbid, // TCR_ELx.TBID{x}
bit e0pd, // TCR_EL1.E0PDx or TCR_EL2.E0PDx when HCR_EL2.E2H == '1'
bits(3) ps, // TCR_ELx.{I}PS
bits(6) txsz, // TCR_ELx.TxSZ
shared/translation/vmsa/SDFType
enumeration SDFType {
SDFType_Table,
SDFType_Invalid,
SDFType_Supersection,
SDFType_Section,
SDFType_LargePage,
SDFType_SmallPage
};
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-565
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/translation/vmsa/SecurityStateForRegime
// SecurityStateForRegime()
// ========================
// Return the Security State of the given translation regime
shared/translation/vmsa/StageOA
// StageOA()
// =========
// Given the final walk state (a page or block descriptor), map the untranslated
// input address bits to the output address
return oa;
shared/translation/vmsa/TGx
enumeration TGx {
TGx_4KB,
TGx_16KB,
TGx_64KB
};
shared/translation/vmsa/TGxGranuleBits
// TGxGranuleBits()
// ================
// Retrieve the address size, in bits, of a granule
shared/translation/vmsa/TLBContext
type TLBContext is (
SecurityState ss,
Regime regime,
I1-566 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
bits(16) vmid,
bits(16) asid,
bit nG,
PASpace ipaspace, // Used in stage 2 lookups & invalidations only
boolean includes_s1,
boolean includes_s2,
bits(64) ia, // Input Address
TGx tg,
bit cnp,
)
shared/translation/vmsa/TLBRecord
type TLBRecord is (
TLBContext context,
TTWState walkstate,
integer blocksize, // Number of bits directly mapped from IA to OA
integer contigsize, // Number of entries log 2 marking a contiguous output range
bits(64) s1descriptor, // Stage 1 leaf descriptor in memory (valid if the TLB caches stage 1)
bits(64) s2descriptor // Stage 2 leaf descriptor in memory (valid if the TLB caches stage 2)
)
shared/translation/vmsa/TTWState
type TTWState is (
boolean istable,
integer level,
FullAddress baseaddress,
bit contiguous,
bit nG,
SDFType sdftype, // AArch32 Short-descriptor format walk only
bits(4) domain, // AArch32 Short-descriptor format walk only
MemoryAttributes memattrs,
Permissions permissions
)
shared/translation/vmsa/TranslationRegime
// TranslationRegime()
// ===================
// Select the translation regime given the target EL and PE state
shared/translation/vmsa/TranslationSize
// TranslationSize()
// =================
// Compute the number of bits directly mapped from the input address
// to the output address
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. I1-567
ID062922 Non-Confidential
Armv8-R AArch64 Pseudocode
I1.2 Shared pseudocode
shared/translation/vmsa/UseASID
// UseASID()
// =========
// Determine whether the translation context for the access requires ASID or is a global entry
shared/translation/vmsa/UseVMID
// UseVMID()
// =========
// Determine whether the translation context for the access requires VMID to match a TLB entry
shared/translation/vmsa/VARange
enumeration VARange {
VARange_LOWER,
VARange_UPPER
};
I1-568 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Glossary
A64 instruction A word that specifies an operation to be performed by a PE that is executing in an Exception level that is using
AArch64. A64 instructions must be word-aligned.
Advanced SIMD A feature of the Arm architecture that provides SIMD operations on a register file of SIMD and floating-point
registers. Where an implementation supports both Advanced SIMD and floating-point instructions, these
instructions operate on the same register file.
Architecturally mapped
Where this manual describes a register as being architecturally mapped to another register, this indicates that, in an
implementation that supports both of the registers, the two registers access the same state.
Architecturally UNKNOWN
An architecturally UNKNOWN value is a value that is not defined by the architecture but must meet the requirements
of the definition of UNKNOWN. Implementations can define the value of the field, but are not required to do so.
CONSTRAINED UNPREDICTABLE
Where an instruction can result in UNPREDICTABLE behavior, the Armv8 architecture specifies a narrow range of
permitted behaviors. This range is the range of CONSTRAINED UNPREDICTABLE behavior. All implementations that
are compliant with the architecture must follow the CONSTRAINED UNPREDICTABLE behavior.
Execution at Non-secure EL1 or EL0 of an instruction that is CONSTRAINED UNPREDICTABLE can be implemented
as generating a trap exception that is taken to EL2, provided that at least one instruction that is not UNPREDICTABLE
and is not CONSTRAINED UNPREDICTABLE causes a trap exception that is taken to EL2.
Armv8-R AArch64
Architecture described in this supplement.
EL1 MPU Memory Protection Unit that can be configured from EL1 or EL2. EL1 MPU is used by software running at EL1.
EL2 MPU Memory Protection Unit that can be configured only from EL2. EL2 MPU is used by software running at EL2.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. Glossary-569
ID062922 Non-Confidential
Glossary
IMPLEMENTATION DEFINED
Means that the behavior is not architecturally defined, but must be defined and documented by individual
implementations.
Load/Store architecture
An architecture where data-processing operations only operate on register contents, not directly on memory
contents.
PMSA
Protected Memory System Architecture - implementing an MPU
Protection region
A memory region whose position, size, and other properties are defined by Memory Protection Unit registers.
RES0 A reserved bit. Used for fields in register descriptions, and for fields in architecturally-defined data structures that
are held in memory, for example in translation table descriptors.
Within the architecture, there are some cases where a register bit or field:
• Is RES0 in some defined architectural context.
• Has different defined behavior in a different architectural context.
Note
• RES0 is not used in descriptions of instruction encodings.
• Where an AArch32 System register is Architecturally mapped to an AArch64 System register, and a bit or
field in that register is RES0 in one Execution state and has defined behavior in the other Execution state, this
is an example of a bit or field with behavior that depends on the architectural context.
Glossary-570 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Glossary
This means the definition of RES0 for fields in read/write registers is:
A bit that is RES0 in a context is reserved for possible future use in that context. To preserve forward compatibility,
software:
• Must not rely on the bit reading as 0.
• Must use an SBZP policy to write to the bit.
This RES0 description can apply to a single bit, or to a field for which each bit of the field must be treated as RES0.
In body text, the term RES0 is shown in SMALL CAPITALS.
RES1 A reserved bit. Used for fields in register descriptions, and for fields in architecturally-defined data structures that
are held in memory, for example in translation table descriptors.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. Glossary-571
ID062922 Non-Confidential
Glossary
Within the architecture, there are some cases where a register bit or field:
• Is RES1 in some defined architectural context.
• Has different defined behavior in a different architectural context.
Note
• RES1 is not used in descriptions of instruction encodings.
• Where an AArch32 System register is Architecturally mapped to an AArch64 System register, and a bit or
field in that register is RES1 in one Execution state and has defined behavior in the other Execution state, this
is an example of a bit or field with behavior that depends on the architectural context.
This means the definition of RES1 for fields in read/write registers is:
If the bit has not been successfully written since reset, then the read of the bit returns the reset
value if there is one, or otherwise returns an UNKNOWN value.
• A direct write to the bit must update a storage location associated with the bit.
• While the use of the register is such that the bit is described as RES1, the value of the bit must
have no effect on the operation of the PE, other than determining the value read back from
that bit, unless this Manual explicitly defines additional properties for the bit.
Considering only contexts that apply to a particular implementation, if there is a context in which a
bit is defined as RES0, another context in which the same bit is defined as RES1, and no context in
which the bit is defined as a functional bit, then it is IMPLEMENTATION DEFINED whether:
• Writes to the bit are ignored, and reads of the bit return an UNKNOWN value.
• The value of the bit can be written, and a read returns the last value written to the bit.
The RES1 description can apply to bits or fields that are read-only, or are write-only:
• For a read-only bit, RES1 indicates that the bit reads as 1, but software must treat the bit as UNKNOWN.
Glossary-572 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Glossary
• For a write-only bit, RES1 indicates that software must treat the bit as SBO.
A bit that is RES1 in a context is reserved for possible future use in that context. To preserve forward compatibility,
software:
• Must not rely on the bit reading as 1.
• Must use an SBOP policy to write to the bit.
This RES1 description can apply to a single bit, or to a field for which each bit of the field must be treated as RES1.
In body text, the term RES1 is shown in SMALL CAPITALS.
Read-As-Zero (RAZ)
Hardware must implement the field as reading as all 0s.
Software:
• Can rely on the field reading as all 0s
• Must use a SBZP policy to write to the field.
This description can apply to a single bit that reads as 0, or to a field that reads as all 0s.
Read-As-One (RAO)
Hardware must implement the field as reading as all 1s.
Software:
• Can rely on the field reading as all 1s.
• Must use a SBOP policy to write to the field.
This description can apply to a single bit that reads as 1, or to a field that reads as all 1s.
Should-Be-Zero-or-Preserved (SBZP)
From the introduction of the Armv8 architecture, the description Should-Be-Zero-or-Preserved (SBZP) is
superseded by RES0.
Note
The Armv7 Large Physical Address Extension modified the definition of SBZP for register bits that are SBZP in
some but not all contexts. The behavior of these bits is covered by the RES0 definition, but not by the generic
definition of SBZP given here.
When writing this field, software must either write all 0s to this field or, if the register is being restored from a
previously read state, write the previously read value to this field. If this is not done, then the result is unpredictable.
This description can apply to a single bit that should be written as its preserved value or as 0, or to a field that should
be written as its preserved value or as all 0s.
Should-Be-One (SBO)
Hardware must ignore writes to the field.
Arm strongly recommends that software writes the field as all 1s. If software writes a value that is not all 1s, it must
expect an UNPREDICTABLE or CONSTRAINED UNPREDICTABLE result.
This description can apply to a single bit that should be written as 1, or to a field that should be written as all 1s.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. Glossary-573
ID062922 Non-Confidential
Glossary
Should-Be-One-or-Preserved (SBOP)
From the introduction of the Armv8 architecture, the description Should-Be-One-or-Preserved (SBOP) is
superseded by RES1.
Note
The Armv7 Large Physical Address Extension modified the definition of SBOP for register bits that are SBOP in
some but not all contexts. The behavior of these bits is covered by the RES1 definition, but not by the generic
definition of SBOP given here.
When writing this field, software must either write all 1s to this field or, if the register is being restored from a
previously read state, write the previously read value to this field. If this is not done, then the result is unpredictable.
This description can apply to a single bit that should be written as its preserved value or as 1, or to a field that should
be written as its preserved value or as all 1s.
Arm strongly recommends that software writes the field as all 0s. If software writes a value that is not all 0s, it must
expect an UNPREDICTABLE or CONSTRAINED UNPREDICTABLE result.
This description can apply to a single bit that should be written as 0, or to a field that should be written as all 0s.
Translation Defines the process of generating a valid output memory address from an input address. It also defines the behavior
when it is not possible to generate a valid output address. Translation can be implemented using an MMU or an
MPU.
Translation table
A table held in memory that defines the properties of memory areas of various sizes from 1KB to 1MB.
UNDEFINED Indicates cases where an attempt to execute a particular encoding bit pattern generates an exception, that is taken to
the current Exception level, or to the default Exception level for taking exceptions if the UNDEFINED encoding was
executed at EL0. This applies to:
• Any encoding that is defined as never accessible at the current Exception level.
• Some cases where an enable, disable, or trap control means an encoding is not accessible at the current
Exception level.
If the generated exception is taken to an Exception level that is using AArch32 then it is taken as an Undefined
Instruction exception.
Glossary-574 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922
Glossary
Note
On reset, the default Exception level for taking exceptions from EL0 is EL1. However, an implementation might
include controls that can change this, effectively making EL1 inactive.
UNKNOWN An UNKNOWN value does not contain valid data, and can vary from implementation to implementation. An
UNKNOWN value must not return information that cannot be accessed at the current or a lower level of privilege using
instructions that are not UNPREDICTABLE, are not CONSTRAINED UNPREDICTABLE, and do not return UNKNOWN
values.
An UNKNOWN value can vary from moment to moment, and instruction to instruction, unless it has previously been
assigned, other than at reset, to one of the following registers:
• Any of the general-purpose registers.
• Any of the Advanced SIMD and floating-point registers.
• Any of the Scalable Vector Extension registers.
• Any of the PSTATE N, Z, C, or V flags.
An UNKNOWN value must not be documented or promoted as having a defined value or effect.
In body text, the term UNKNOWN is shown in SMALL CAPITALS.
UNPREDICTABLE
Means the behavior cannot be relied upon. UNPREDICTABLE behavior must not perform any function that cannot be
performed at the current or a lower level of privilege using instructions that are not UNPREDICTABLE.
Execution at Non-secure EL1 or EL0 of an instruction that is UNPREDICTABLE can be implemented as generating a
trap exception that is taken to EL2, provided that at least one instruction that is not UNPREDICTABLE and is not
CONSTRAINED UNPREDICTABLE causes a trap exception that is taken to EL2.
Validation
In an address translation context, validation refers to translation that is implemented by the MPU in which the input
address and output address are always the same.
ARM DDI 0600B.a Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. Glossary-575
ID062922 Non-Confidential
Glossary
Glossary-576 Copyright © 2019-2022 Arm Limited or its affiliates. All rights reserved. ARM DDI 0600B.a
Non-Confidential ID062922