APCS,ARM 过程调用标准(ARM Procedure Call Standard),提供了紧凑的编写例程的一种机制,定义的例程可以与其他例程交织在一起。最显著的一点是对这些例程来自哪里没有明确的限制。它们可以编译自 C、 Pascal、也可以是用汇编语言写成的。

 

The following register names are predeclared:
• r0-r15 and R0-R15
• a1-a4 (argument, result, or scratch registers, synonyms for r0 to r3)
• v1-v8 (variable registers, r4 to r11)
• sb and SB (static base, r9)
• sl and SL (stack limit, r10)
• fp and FP (frame pointer, r11)
• ip and IP (intra-procedure-call scratch register, r12)
• sp and SP (stack pointer, r13)
• lr and LR (link register, r14)
• pc and PC (program counter, r15).
3.3.2 Predeclared program status register names
The following program status register names are predeclared:
• cpsr and CPSR (current program status register)
• spsr and SPSR (saved program status register).
3.3.3 Predeclared floating-point register names
The following floating-point register names are predeclared:
• f0-f7 and F0-F7 (FPA registers)
• s0-s31 and S0-S31 (VFP single-precision registers)
• d0-d15 and D0-D15 (VFP double-precision registers).
3.3.4 Predeclared coprocessor names
The following coprocessor names and coprocessor register names are predeclared:
• p0-p15 (coprocessors 0-15)
• c0-c15 (coprocessor registers 0-15).

 

a1-a4代表R0-R3,在使用汇编语言写函数时,这四个寄存器在结束时不需要恢复成原值,因此在进入函数时不需要保存
v1-v4代表R4-R11,在使用汇编语言写函数时,这四个寄存器在函数返回时需要恢复成原值,因此需要在使用时首先保存,并在返回前恢复成原值
r12-r15可以分别使用ip,sp,lr和pc访问,这些内容是在ATPCS规则中规定的,可以在c:\program files\arm\ads1_2\pdf\specs目录下找到ATPCS规范.