arm_v8 简介
一、层级划分
-
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)
二、 MMU
- MMU相應的系統控制暫存器
ldr x5, = vector MSR VBAR_EL1, x5 MSR TTBR0_EL1, X0 // Set TTBR0 MSR TTBR1_EL1, X1 // Set TTBR1 MSR TCR_EL1, X2 // Set TCR ISB // The ISB forces these changes to be seen before / 指令隔离指令。 // the MMU is enabled. MRS X0, SCTLR_EL1 // Read System Control Register configuration data ORR X0, X0, #1 // Set [M] bit and enable the MMU. MSR SCTLR_EL1, X0 // Write System Control Register configuration data ISB // The ISB forces these changes to be seen by the / // next instruction