分享到plurk 分享到twitter 分享到facebook

版本 bcda30c34702d4cb0333ef63f8f3e233b2675fed

embedded/ARMv8

Changes from bcda30c34702d4cb0333ef63f8f3e233b2675fed to 58ab0f57b39a8210cceffeb84b598f8a20a4e60b

---
title: ARMv8
categories: ARM, ARMv8, ARM64, embedded
...
ARMv8架構介紹
=====================================
.. image:: http://www.arm.com/zh/images/roadmap/V5_to_V8_Architecture.jpg

ARMv8架構有一個重要的特點是他與其之前的架構相容。

Execution state
----------------------------

- AArch64 - 64-bit Execution state.

 - 提供 31組 64-bit 的通用暫存器
 - 提供 64-bit Program Counter(PC), Stack-Poiner(SP)與Exception-Link-Register (ELR)
 - 定義最多四種(EL0 - EL3)特權模式
 - 支援 64-bit 虛擬地址
 - 定義一組PSTATE來保存PE state
  - 提供 31組 64-bit 的通用暫存器
  - 提供 64-bit Program Counter(PC), Stack-Poiner(SP)與Exception-Link-Register (ELR)
  - 定義最多四種(EL0 - EL3)特權模式
  - 支援 64-bit 虛擬地址
  - 定義一組PSTATE來保存PE state

- AArch32 - 32-bit Execution state

 - 提供 16組 32-bit 的通用暫存器
 - 提供 1組 ELR,作為從Hyp-Mode的Exception返回之用
 - 提供 A32(相容ARMv7 ARM)與 T32(相容ARMv7 Thumb)兩種指令集
 - 使用32-bit 虛擬地址
 - 使用單一的CPSR來保存PE state
  - 提供 16組 32-bit 的通用暫存器
  - 提供 1組 ELR,作為從Hyp-Mode的Exception返回之用
  - 提供 A32(相容ARMv7 ARM)與 T32(相容ARMv7 Thumb)兩種指令集
  - 使用32-bit 虛擬地址
  - 使用單一的CPSR來保存PE state

在A32與T32中做切換只要透過BX即可,但要在AArch32與AArch64間做切換只能透過Exception

.. image:: http://loda.hala01.com/wp-content/uploads/2014/12/image005.png

(圖片來自loda大大的blog)

AArch64 指令集 (instruction set) 介紹
=====================================
ARMv8-A_Architecture_Reference_Manual P.111

系統層級架構 (System Level Architecture)
=====================================
ARMv8-A_Architecture_Reference_Manual P.1405

例外層級 (Exception levels)
----------------------------
ARMv8-A_Architecture_Reference_Manual P.1408

- ARMv8-A架構定義了四個例外層級,分別為EL0到EL3,其中數字越大代表特權(privilege)越大。

  - EL0: 無特權模式(unprivileged)
  - EL1: 作業系統核心模式(OS kernel mode)
  - EL2: 虛擬機器監視器模式(Hypervisor mode)
  - EL3: TrustZone® monitor mode

- 要提升到較高層級需要透過exceptions(如: 中斷、page faults等)。

  - EL0 => EL1: SVC (system call)
  - EL1 => EL2: HVC (hypervisor call)
  - EL2 => EL3: SMC (secure monitor call)

- 在轉換時會將返回位址(return address)紀錄在例外連結暫存器ELR(Exception-Link-Register)。
- 每個EL會有個別的SP(stack pointer)

.. image:: /embedded/armv8 arch.png

虛擬記憶體系統架構 (Virtual Memory System Architecture)
------------------------------------------------------------------------------------
ARMv8-A_Architecture_Reference_Manual P.1707

通用計時器 (The Generic Timer)
------------------------------------------------------------------------------------
ARMv8-A_Architecture_Reference_Manual P.1855

reference
=====================================
* `ARMv8-A_Architecture_Reference_Manual_(Issue_A.a) (需登入)<http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0487a.e/index.html>`_
* `loda armv8-與-linux的新手筆記<http://loda.hala01.com/2014/12/armv8-%E8%88%87-linux%E7%9A%84%E6%96%B0%E6%89%8B%E7%AD%86%E8%A8%98/>`_
* http://www.slideshare.net/badaindonesia/linux-on-arm-64bit-architecture?related=1