快速链接:
.
个人博客笔记导读目录(全部)
- 付费专栏-付费课程 【购买须知】:
- 【精选】ARMv8/ARMv9架构入门到精通-[目录]
ARMv8有31个通用寄存器X0-X30, 还有SP、PC、XZR等寄存器
下面详细介绍写这些通用寄存器(general-purpose registers):
部分寄存器还可以当作32位的使用
sp(Stack pointer)
EL1t: t表示选择SP_EL0
EL1h:h表示选择SP_ELx(x>0)
PC(Program Counter)
在armv7上PC是一个通用寄存器R15,在armv8上PC不在是一个寄存器,它不能直接被修改。必需使用一些隐式的指令来改变,如PC-relative load
- N Negative result (N flag).
- Z Zero result (Z) flag.
- C Carry out (C flag).
- V Overflow (V flag).
- SS Software Step. Indicates whether software step was enabled when an exception was taken.
- IL Illegal Execution State bit. Shows the value of PSTATE.IL immediately before the exception was taken.
- D Debug mask:watchpoint,breakpoint
- A SError (System Error) mask bit.
- I IRQ mask bit.
- F FIQ mask bit.
- M[4] Execution state that the exception was taken from. A value of 0 indicates AArch64.
- M[3:0] Mode or Exception level that an exception was taken from
PSTATE (Processor state)
在aarch64中,调用ERET从一个异常返回时,会将SPSR_ELn恢复到PSTATE中,将恢复:ALU的flag、执行状态(aarch64 or aarch32)、异常级别、processor branches
PSTATE.{N, Z, C, V}可以在EL0中被修改,其余的bit只能在ELx(x>0)中修改
执行状态的切换(aarch64/aarch32)
当从aarch32切换到aarch64时:
1、一些64位寄存器的高32bit,曾经被map到aarch32中的一些寄存器。这些高32bit是unknown状态
2、一些64位寄存器的高32bit,在aarch32中没有使用,这些高32bit还是以前的值;
3、如果是跳转到EL3,EL2是aarch32,那么ELR_EL2的高32bit是unknown
4、以下寄存器,不会再aarch32中使用到
— SP_EL0.
— SP_EL1.
— SP_EL2.
— ELR_EL1