ARM CPU 為用戶模式提供了 16 個(gè)通用寄存器和一個(gè)狀態(tài)寄存器 (CPSR), 不同模式間還提供有備份狀態(tài)寄存器(SPSR). 對于軟硬件的一些約定, 下面三個(gè)寄存器有著不同的含義, 使用時(shí)要注意:
R13 is used as stack pointer (SP) that holds the current stack address(堆棧指針)
R14 is used as link register (LR) that saves return address for the BL and BLX instruction(鏈接寄存器)
R15 is used as program counter (PC) that points to the executed instruction(程序計(jì)數(shù)器)
當(dāng)不同的 CPU 操作模式之間進(jìn)行切換時(shí), ARM 提供了影子寄存器. 這些影子寄存器可以縮短中斷延遲時(shí)間(Interrupt Latency), 以提高性能. 這些寄存器的分布如下圖所示: