r0 Volatile register used in function prologs r1 Stack frame pointer r2 TOC pointer r3 Volatile parameter and return value register r4-r10 Volatile registers used for function parameters r11 Volatile register used in calls by pointer and as an environment pointer for languages which require one r12 Volatile register used for exception handling and glink code r13 Reserved for use as system thread ID r14-r31 Nonvolatile registers used for local variables f0 Volatile scratch register f1-f4 Volatile floating point parameter and return value registers f5-f13 Volatile floating point parameter registers f14-f31 Nonvolatile registers LR Link register (volatile) CTR Loop counter register (volatile) XER Fixed point exception register (volatile) FPSCR Floating point status and control register (volatile) CR0-CR1 Volatile condition code register fields CR2-CR4 Nonvolatile condition code register fields CR5-CR7 Volatile condition code register fieldsOn processors with the VMX feature.
v0-v1 Volatile scratch registers v2-v13 Volatile vector parameters registers v14-v19 Volatile scratch registers v20-v31 Non-volatile registers vrsave Non-volatile 32-bit registerThe existence of the VMX feature will be indicated in the AT_HWCAP auxiliary vector entry.
Registers r1, r14 through r31, and f14 through f31 are nonvolatile, which means that they preserve their values across function calls. Functions which use those registers must save the value before changing it, restoring it before the function returns. Register r2 is technically nonvolatile, but it is handled specially during function calls as described below: in some cases the calling function must restore its value after a function call.
Registers r0, r3 through r12, f0 through f13, and the special purpose registers LR, CTR, XER, and FPSCR are volatile, which means that they are not preserved across function calls. Furthermore, registers r0, r2, r11, and r12 may be modified by cross-module calls, so a function can not assume that the values of one of these registers is that placed there by the calling function.
The condition code register fields CR0, CR1, CR5, CR6, and CR7 are volatile. The condition code register fields CR2, CR3, and CR4 are nonvolatile; a function which modifies them must save and restore at least those fields of the CR. Languages that require "environment pointers" shall use r11 for that purpose.
The following registers have assigned roles in the standard calling sequence:
- r1
- The stack pointer (stored in r1) shall maintain quadword alignment. It shall always point to the lowest allocated valid stack frame, and grow toward low addresses. The contents of the word at that address always point to the previously allocated stack frame. If required, it can be decremented by the called function. See Section 3.5.13 for additional infromation. As discussed later in this chapter, the lowest valid stack address is 288 bytes less than the value in the stack pointer. The stack pointer must be atomically updated by a single instruction, thus avoiding any timing window in which an interrupt can occur with a partially updated stack.
- r2
- This register holds the TOC base. See Section 3.5.2 for additional information.
- r3 through r10 and f1 through f13
- These sets of volatile registers may be modified across function invocations and shall therefore be presumed by the calling function to be destroyed. They are used for passing parameters to the called function. See Section 3.2.3 for additional information. In addition, registers r3 and f1 through f4 are used to return values from the called function, as described in Section 3.2.4.
- LR (Link Register)
- This register shall contain the address to which a called function normally returns. LR is volatile across function calls.
Ref:
http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.7.html
No comments:
Post a Comment