Armv8-A内存模型指南

需积分: 12 4 下载量 35 浏览量 更新于2024-07-15 收藏 795KB PDF 举报
"Armv8-A memory model 是 ARM 公司在 Armv8-A 架构中定义的一种内存模型,该模型详细规定了处理器如何访问和处理内存中的数据,包括内存区域的属性、内存属性的来源与分配方式,以及内存排序的基本原则。此文档为 Version 1.0,于2019年4月首次发布,是非保密性质的。文档内容可能受到版权保护,并可能涉及专利,未经 ARM 公司明确书面许可,不得复制或实施其中信息。用户使用该文档信息时需同意不用于评估第三方专利侵权的可能性。" 在 Armv8-A 架构中,内存模型是理解和编程的关键部分,因为它定义了指令执行的顺序、数据一致性以及多核处理器间的通信规则。以下是 Armv8-A 内存模型的一些关键知识点: 1. **内存属性**:内存系统中的不同区域可以有不同的属性,例如,有的可能是易失性的,有的则具有缓存能力。这些属性决定了数据的存储和访问方式,对性能和一致性有直接影响。 2. **属性来源与分配**:内存属性通常由硬件平台的配置决定,例如,内存控制器和缓存策略。这些属性被分配给内存的不同区域,如代码段、数据段、堆和栈。 3. **内存排序**:内存模型定义了内存操作的排序规则,这涉及到指令重排序、数据依赖性和缓存一致性。在 Armv8-A 中,内存模型保证了特定的顺序约束,以确保多线程或多处理器环境下的正确性。 4. **内存访问级别**:Armv8-A 支持不同的内存访问级别,如 Strongly-ordered、Sequentially-consistent、Shared 和 Unbuffered 等,这些访问级别影响着数据的可见性和同步。 5. **一致性模型**:Armv8-A 采用的内存一致性模型确保了所有处理器看到的内存状态是一致的。例如,Load-Store 顺序一致性模型要求所有处理器的读写操作按其程序顺序执行,即使它们可能被缓存和重新排序。 6. **缓存和一致性协议**:在多核系统中,每个核心可能有自己的缓存,因此需要一种机制来确保缓存的一致性。Armv8-A 使用了如 AMBA(Advanced Microcontroller Bus Architecture)总线协议中的缓存一致性协议,如 ARMv8 的 CCIX、CPI 或者早期的 ARMv7-A 的 AMBA-3 AXI。 7. **原子操作**:Armv8-A 提供了原子操作(如 Load-Exclusive 和 Store-Exclusive),保证在多线程环境下对特定内存位置的访问是不可分割的,防止数据竞争问题。 8. **Barriers**:内存屏障是另一种关键工具,它强制执行特定的内存操作顺序,防止指令的乱序执行。在 Armv8-A 中,有多种类型的内存屏障(如 DMB、DSB 和 DSB SY)来满足不同的同步需求。 理解 Armv8-A 内存模型对于编写高效、正确并能在多核处理器上正确运行的代码至关重要。开发人员需要根据这个模型来设计并发和同步机制,以确保程序的正确性和性能。
2016-12-29 上传
This manual describes the ARM® architecture v8, ARMv8. The architecture describes the operation of an ARMv8-A Processing element (PE), and this manual includes descriptions of: • The two Execution states, AArch64 and AArch32. • The instruction sets: — In AArch32 state, the A32 and T32 instruction sets, that are compatible with earlier versions of the ARM architecture. — In AArch64 state, the A64 instruction set. • The states that determine how a PE operates, including the current Exception level and Security state, and in AArch32 state the PE mode. • The Exception model. • The interprocessing model, that supports transitioning between AArch64 state and AArch32 state. • The memory model, that defines memory ordering and memory management. This manual covers a single architecture profile, ARMv8-A, that defines a Virtual Memory System Architecture (VMSA). • The programmers’ model, and its interfaces to System registers that control most PE and memory system features, and provide status information. • The Advanced SIMD and floating-point instructions, that provide high-performance: — Single-precision and double-precision floating-point operations. — Conversions between double-precision, single-precision, and half-precision floating-point values. — Integer, single-precision floating-point, and in A64, double-precision vector operations in all instruction sets. — Double-precision floating-point vector operations in the A64 instruction set. • The security model, that provides two security states to support secure applications. • The virtualization model, that support the virtualization of Non-secure operation. • The Debug architecture, that provides software access to debug features.