huchuan2025/20-Area/22-Work/222-ReadNote/armv8体系结构/ARMv8寄存器汇总 (重要).md

133 lines
4.0 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- 写在前面
- 寄存器大小写不敏感 currentel currentEL都可以
- 通用寄存器 General-Purpose Register
- x0-x31
- w0-w31
- 特殊寄存器 Special-Purpose Register
- Pstate (跟spsr是对应的只不过可以拆开来用)
- CurrentEL
- 例子 `mrs x0 CurrentEL`
- 典型应用场景
- DAIF
- 例子 `mrs x0 daif`
- 典型应用场景
- NZCV
- 例子 `mrs x0 nzcv`
- 典型应用场景
- PAN Privileged Access Never 可选
- ARMv8.1-PAN
- UAO User Access Override 可选
- ARMv8.2-UAO
- DIT Data Independent Timing 可选
- ARMv8.4-DIT
- 例子
- 典型应用场景
- TCO Tag Check Override
- ARMv8.5-MemTag
- SSBS
- ARMv8.0-SSBS 8.5
- ELR Related **重要**
- ELR
- 说明 记录异常地址返回值 看一下LR寄存器
- 典型应用场景
- 进入异常时,硬件设置
- kernel_entry 处理异常 ?
- kernel_exit 异常退出
- `msr elr_el1, x21`
- SPSR Related **重要**
- SPSR
- 说明 用于进入异常之前备份Pstate
- 典型应用场景
- 进入异常时硬件设置
- kernel_entry 处理异常
- kernel_exit 异常退出
- `msr spsr_el1, x22`
- Floating Point Related 补充
- FPCR
- FPSR
- 系统寄存器 Reg_ELn n=0-3
- 基本分类
- 通用系统控制寄存器 **General System Control Register**
- 重要
- 调试寄存器 Debug Register
- 部分寄存器DBG开头
- 性能监控寄存器 Performance Monitor Register
- PM开头
- 活动监控寄存器 Activity Monitor Resister
- AM开头
- 统计扩展寄存器 Statistical Profiling Extention Register
- PM开头
- RAS 寄存器 Reliability, Availability, and Serviceability Extension Register
- 大部分ER开头
- 通用定时器寄存器 Generic Timer Resister
- CNT开头 CNTP开头
- 通用系统寄存器列表
- VBAR **Vector Base Address Register**
- 说明 中断向量基地址
- 典型使用场景
- Linux \_\_primary_switched中设置为vectors中的地址
- `adr_l  x8, vectors` // load VBAR_EL1 with virtual
- `msr    vbar_el1, x8` // vector table address
- Rt-thread rt_hw_set_current_vbar
- `MSR     VBAR_EL1,X0`
- Cache相关
- CTR **Cache Type Register** 只有EL0
- 说明
- 典型使用场景
- Linux read_cpuid_cachetype()
- 地址转换相关 TCR/SCTLR/TTBR
- TCR **Translation Control Register**
- 说明 控制页表转换控制, 一堆可配置bit位
- SCTLR **System Control Register** EL1-EL3
- 说明 系统控制一堆可配置bit位
- 典型使用场景
- 设置大小端
- 设置MMU
- TTBR
- 说明 页表基地址
- 典型使用场景
- 设置页表基地址
- 异常相关
- ESR **Exception Syndrome Register**
- 说明 记录了异常原因的寄存器 一共有5个有效bit叫做exception class
- 典型使用场景 ?没分析对
- ID寄存器 MIDR/MPIDR/REVIDR/TPIDR
- MPIDR **Multiprocessor Affinity Register** EL1
- 说明 只读寄存器记录PE亲和信息 aff0-3 由小到大记录PE的id有超线程会记录超线程
- ![[mpidr说明.png]]
- 观测方法
- 未知
- 典型场景
- Linux ==调查==
- Rt-thread
- TPIDR **Read/Write Software Thread ID Register** EL0-EL3
- 说明 PE不用这个寄存器 纯给OS软件用 我理解就是软件自己定义的cpuid从mpidr转化而来
- 典型场景
- Linux ==不清楚==
- Rt-thread 存Lwp ID用
- MIDR
- 说明 用于显示厂商,架构等 EL1
- 观测方法
-
- 典型场景 没啥用
- REVIDR
- 说明 提供次要修订信息 厂商自己实现全0
- SCR/HCR
- HCR Hypervisor Configuration Register 只有EL2
- 功能 用来配置EL2
- SCR Secure Config Register 只有EL3
- 功能 用来配置EL3
- 使用场景
- 与中断路由有关系
- TVAL
- MAIR
- , Memory Attribute Indirection Register
- CLIDR
- CSSELR
- CCSIDR
- DCZID
- MODE
- RMR
- RVBAR
- CPACR
- ZCR