Reading the Arm ARM
The Arm Architecture Reference Manual for A-profile architecture (Arm DDI0487) runs to more than 10,000 pages. Nobody reads it front to back. This page explains how it is organised, which companion documents fill the gaps it leaves, how to read its pseudocode, and the precise meaning of the capitalised words that decide what you may rely on.
How DDI0487 is organised
The manual is divided into lettered parts. Chapter numbers inside a part move between issues as material is added, so this book cites chapter and section titles, not numbers. The one exception is chapter A2, the list of architecture extensions, which is cited by number.
| Part | Contents | When you go there |
|---|---|---|
| A | Introduction and architecture overview. Chapter A2 lists the architecture extensions and every FEAT_ name, with the version in which each feature is permitted and the version from which it is mandatory, plus the dependencies between features. | “Is this feature in v9.2?”, “What does FEAT_X require?” |
| B | The AArch64 application-level architecture: the application programmer’s model and the AArch64 application-level memory model, which covers memory types and attributes, ordering, observability and completion, barriers, atomicity, and caches as software at EL0 sees them | Everything in Parts 6, 7 and 10 of this book |
| C | The A64 instruction set: encoding overview, encoding index, and an alphabetical description of each instruction (base, SIMD and FP and, in recent issues, SVE and SME), each with its decode and operation pseudocode | “What exactly does LDAPR / DC CIVAC / TLBI RVAE1IS do?” |
| D | The AArch64 system-level architecture: the system programmer’s model, exceptions, the virtual memory system architecture (VMSA, translation and TLB maintenance), the Generic Timer, self-hosted debug, the PMU, the AMU, MTE, RME and other system features, and the AArch64 system register descriptions | Most of Parts 2–5, 8, 9 and 11–17 |
| E, F, G | AArch32: the application level, the A32 and T32 instruction sets, and the system level | Only when AArch32 state affects your AArch64 code (EL0 compatibility, SPSR encodings, SCR_EL3.RW) |
| H | External debug: the debug state, halting, the external debug interface and its registers | 16.2, 18.2 |
| I | Memory-mapped system register descriptions: the memory-mapped Generic Timer frames (CNTControlBase, CNTCTLBase, CNTBaseN), the external debug, CTI, PMU and AMU register frames | 4.6, 16.2 |
| J | The architectural pseudocode library: the shared functions used by every instruction and register description (translation, exception entry, permission checks, the memory model’s access functions) | When prose is ambiguous |
| K | Appendices, including the architectural constraints on UNPREDICTABLE behaviors and the barrier litmus tests, which also give the recommended barrier and maintenance sequences for common cases | 7.3, 7.10, 8.5 |
A glossary closes the manual. The terms the Arm ARM sets in small capitals, such as IMPLEMENTATION DEFINED and UNKNOWN, are defined there, and the glossary entry is the definition that counts.
Two practical habits help:
- Use the PDF’s bookmarks and full-text search, not the page numbers. Search for the register name with its suffix (
TCR2_EL1), or for a quoted phrase from the rule you want (“context synchronization event”). - Read the rule’s conditions, not just the rule. Most statements are scoped by Exception level, Security state, feature presence (“When FEAT_X is implemented”) or memory type. A rule quoted without its conditions is usually wrong somewhere.
Errata to the manual
Arm publishes a Known Issues document for each DDI0487 issue (Arm document 102105). The entries are corrections and clarifications, some of which change behaviour that software relies on. 7.5 describes an example: the redefinition of the DMB shareability argument. When this book cites a Known Issues entry, it gives the entry identifier and the issue it was raised against.
Registers and instructions outside the PDF
The register and instruction descriptions are also published per architecture release, as HTML and in machine-readable form:
- Arm A-profile Architecture Registers (DDI0601) has one page per system register. Each page gives the field layout, the conditions for each field, the reset behaviour, and an Accessing section containing the pseudocode for each
MRS/MSRencoding, including every trap. That section answers questions such as “which EL does this access trap to, and with what EC?” - A64 Instruction Set Architecture (DDI0602) is the instruction descriptions in the same form.
- The machine-readable specification. Arm publishes the register and instruction data as XML and as JSON (the Arm Architecture Machine Readable Specification). Tools that generate register headers, disassemblers and test generators consume it. When the HTML and a header file disagree, check the release each was generated from.
These releases are named by date and often appear before the corresponding DDI0487 issue. For a brand-new extension they are the only description. Code that uses them should record which release it was written against.
Reference mappings that are useful but not authoritative: TF-A’s include/arch/aarch64/arch.h (field and bit definitions used by EL3 code), and Linux’s arch/arm64/tools/sysreg (from which the kernel generates its register definitions).
Companion specifications
DDI0487 specifies the PE. The rest of the system is specified elsewhere:
| Document | Specifies | Used in |
|---|---|---|
| IHI0069, GIC architecture (GICv3 and GICv4) | Distributor, Redistributors, ITS, the CPU interface and its ICC_* registers, and the virtual CPU interface | Part 4, 11.4 |
| IHI0070, SMMU architecture (SMMUv3) | Stream tables, context descriptors, the command and event queues, and SMMU translation | 11.5 |
| DDI0587, RAS supplement | The error record registers (ERRnSTATUS and the rest), error injection, and the RAS model at system level | 16.7, 16.8 |
| DEN0129, RME system architecture | What a system needs beyond the PE for RME: physical address space (PAS) tagging of every transaction, granule protection checks for requesters other than the PE (such as the SMMU), PAS filtering at completers, and the requirements on memory encryption and the system Root of Trust | 12.4, 12.5 |
| DEN0094, BSA, and DEN0029, SBSA | The base and server system architectures: minimum hardware a compliant OS can rely on (timers, watchdogs, GIC, SMMU, PCIe and so on) | 18.6 |
| DEN0022 PSCI, DEN0028 SMCCC, DEN0077 FF-A | Firmware interfaces (not architecture, but every EL3 and EL2 component implements them) | 12.3, 17.4 |
Core-specific documents fill in what the architecture leaves IMPLEMENTATION DEFINED: the core’s Technical Reference Manual (TRM) and its Software Developer Errata Notice (SDEN). See 1.3.
Reading the pseudocode
The Arm ARM describes instruction behaviour, register accesses and most system mechanisms in ASL (Arm Architecture Specification Language). The pseudocode is normative unless the text around it says otherwise, and it resolves ambiguity in the prose more often than any other source. Its main features:
- Types.
bits(N)is a bitvector of width N,integeris unbounded, andbooleanisTRUE/FALSE. Bit literals are quoted:'1','0101'. Slicing isx<7:4>and concatenation isa:b. - Layout. Blocks are delimited by indentation, as in Python. Fields are named as in the register descriptions:
SCTLR_EL1.M,PSTATE.EL,HCR_EL2.TGE. - Feature checks. Recent issues write
IsFeatureImplemented(FEAT_X). Older issues use one function per feature,HaveXExt(). Either way, a feature check is a static property of the implementation, not a run-time enable. - Non-determinism.
UNKNOWNvalues,IMPLEMENTATION_DEFINED "name"choices, andConstrainUnpredictable(Unpredictable_...)calls mark the places where the architecture allows several behaviours. Search for these when you need to know what an implementation is permitted to do.
A register access function has a typical shape. The fragment below is simplified and illustrative, not quoted: the real function also handles fine-grained traps, nested virtualization and more ELs.
// Shape of the MSR SCTLR_EL1, <Xt> access pseudocode (simplified)
if PSTATE.EL == EL0 then
UNDEFINED;
elsif PSTATE.EL == EL1 then
if EL2Enabled() && HCR_EL2.TVM == '1' then
AArch64.SystemAccessTrap(EL2, 0x18); // EC 0x18: MSR/MRS/system instruction trap
else
SCTLR_EL1 = X[t, 64];
elsif PSTATE.EL == EL2 then
...
Read such a function from the top. The first branch that matches decides the outcome, so the order of the checks is the priority of the traps. That ordering is often what a validation test needs, and the prose rarely states it.
The library functions you will meet most often are AArch64.TakeException() (exception entry), AArch64.ExceptionReturn(), the translation functions (from AArch64.FullTranslate() down in recent issues), and the memory access and barrier functions behind the memory model. Their names vary slightly between issues, so search for them rather than relying on memory.
The pseudocode is a specification, not a model of hardware. In particular it is sequential: it describes one PE executing one instruction at a time. The memory model is specified separately, as axioms over executions, in the application-level memory model chapter of Part B, with litmus tests in Part K. herd7’s aarch64.cat is the formal model that matches it (7.3). Pseudocode that performs Mem[] accesses in program order does not mean the accesses are observed in program order.
The words that carry weight
These terms are defined in the glossary. The definitions decide what firmware may assume and what a validation test may flag as a bug.
| Term | Meaning | Consequence |
|---|---|---|
| IMPLEMENTATION DEFINED | The architecture allows a choice, and the implementation must document the choice it makes, for example in the TRM. “IMPLEMENTATION DEFINED, with constraints” limits the choice to a set. | Portable code reads an ID register or treats the choice as a platform parameter. A test checks behaviour against the TRM, not against the Arm ARM alone. |
| UNKNOWN | A value that software must not rely on. It can differ between implementations, between resets and between reads. An UNKNOWN value must not reveal information that the current Exception level could not otherwise access. | Most system register fields reset to UNKNOWN unless the description says otherwise. Firmware must write every field it depends on, and must not build a value by read-modify-write of a reset value (17.1). |
| UNPREDICTABLE | Behaviour that software must not rely on. It must not be a security hole: it may not do anything that code at the same or a lower privilege could not do by other means, and it must not halt or hang the PE or the system. | Rare in AArch64, where most such cases are CONSTRAINED. A test that triggers UNPREDICTABLE behaviour cannot have an expected result, only security checks. |
| CONSTRAINED UNPREDICTABLE | Behaviour that software must not rely on, but limited to a listed set of permitted behaviours. The Part K appendix on architectural constraints on UNPREDICTABLE behaviors lists the sets. In pseudocode it appears as ConstrainUnpredictable(). | A test of a CONSTRAINED UNPREDICTABLE case must accept every permitted behaviour, and only those. A model and silicon may legitimately differ. |
| UNDEFINED | Executing the instruction generates an Undefined Instruction exception. This is a defined behaviour, not a vague one. | An unimplemented instruction or register encoding is UNDEFINED and is reported with ESR_ELx.EC 0x00 (unknown reason). A feature that is implemented but disabled by a trap control usually reports its own EC instead (3.2). |
| RES0 | Reserved, should be zero. The bit might be used by a future extension, or by a feature this implementation lacks. Hardware may implement it as read-as-zero, write-ignored, or as a stored bit. Software must not rely on it reading as 0. When writing a register, software writes 0 or writes back a value it previously read from the same register (the SBZP rule). | Writing 1 to a RES0 bit is how a field that is later allocated gets enabled by accident. Write 0 unless you know the feature exists. |
| RES1 | The same with 1: software must write 1, or preserve a value it read. | SCTLR_ELx has several RES1 bits. A firmware constant that leaves them 0 may work on one model and change behaviour on another. |
| RAZ/WI, RAO/WI | Read-as-zero (or one), writes ignored. Unlike RES0, this is a statement about hardware behaviour, not a reservation. | Safe to test for. |
Two related habits: “is permitted to” means the behaviour may occur and software must cope with it. “Is required to” and “must” mean a validation test may flag its absence as a bug. Wording such as “it is expected that” or “Arm recommends” introduces non-normative guidance, which an implementation may ignore.
Looking things up
A register or a field. Start from its DDI0601 page or its entry in the Part D system register descriptions:
- Check the purpose and the configuration notes (“This register is present only when FEAT_X is implemented”).
- For each field, read the conditions (“When FEAT_Y is implemented … Otherwise, RES0”) and the reset behaviour (Warm reset, Cold reset, “architecturally UNKNOWN”).
- Read the Accessing pseudocode for each encoding you use. It shows every trap, the EL it goes to, and the priority order between traps.
If all you have is a disassembly, a system register appears as an encoding. For example, mrs x0, S3_0_C1_C0_0 is op0=3, op1=0, CRn=1, CRm=0, op2=0, which is SCTLR_EL1. The register index by encoding in DDI0601, or the encoding table in Part D, maps it back to a name (2.5).
A feature. Find FEAT_X in chapter A2. That gives the versions in which it is permitted and mandatory, the features it requires, and the ID register field that reports it. Then read the field’s description: whether it is signed or unsigned, and what each value means (1.1). Finally, search Part D for “When FEAT_X is implemented” to find every control the feature adds. That list is your enable checklist (17.3).
An instruction. Use its page in Part C or DDI0602. Read the decode pseudocode first, because it holds the UNDEFINED and CONSTRAINED UNPREDICTABLE cases, and the operation pseudocode second. For barriers and maintenance instructions, the operation pseudocode is thin: the semantics live in the memory model prose in Part B and in the VMSA chapter of Part D.
A rule you half-remember. Search for its key phrase in quotation marks, then read the whole paragraph and its conditions. If the rule concerns ordering, check it against a litmus test in herd7 before relying on it (7.11).