Android CPU 寄存器名称? [英] Android CPU register names?
问题描述
此代码片段摘自三星 Tab S 上的 Android 崩溃报告:
This code fragment is extracted from an Android crash report on a Samsung Tab S:
Build fingerprint: 'samsung/chagallwifixx/chagallwifi:5.0.2/LRX22G/T800XXU1BOCC:user/release-keys'
Revision: '7'
ABI: 'arm'
r0 a0d840bc r1 a0dcb880 r2 00000001 r3 a0d840bc
r4 a0dc3c4c r5 00000000 r6 a066d200 r7 00000000
r8 32d68f40 r9 a0c359a8 sl 00000014 fp bef3ba84
ip a0dc3fb8 sp bef3ba10 lr a0c35a0c pc a0c34bc8 cpsr 400d0010
r0
到 r9
显然是通用寄存器,sp
(r13
) 是堆栈指针,而pc
(r15
) 是程序计数器(指令指针).参考 维基百科的 ARM 架构页面寄存器部分(许多 我浏览的页面),我发现 lr
(r14
) 是链接寄存器,而 cpsr
是当前程序状态寄存器"."
r0
through r9
are pretty clearly general purpose registers, sp
(r13
) is the stack pointer, and pc
(r15
) is the program counter (instruction pointer). Referring to the Wikipedia's ARM Architecture page Registers section (one of many pages I looked through), I find that lr
(r14
) is the link register, and cpsr
is the "Current Program Status Register."
我想知道什么sl
(r10
), fp
(r11
) 和ip
(r12
) 是.我希望 ip
不是指令指针",因为该功能是由 pc
(r15
) 完成的.
I would like to know what sl
(r10
), fp
(r11
) and ip
(r12
) are. I expect ip
is not the "instruction pointer" because that function is done by pc
(r15
).
是否有我没有找到的参考文档来说明这些名称?
Is there a reference document I haven't found that illustrates these names?
推荐答案
当前 ARM EABI 过程调用标准概述了 r12-r15 的标准特殊"名称:
The current ARM EABI procedure call standard outlines the standard 'special' names for r12-r15:
- PC (r15):程序计数器
- LR (r14):链接寄存器
- SP (r13):堆栈指针
- IP (r12):程序内暂存寄存器*
GNU 工具还支持来自已弃用的旧版 APCS 的名称作为标识符对于给定的寄存器编号,即使它们不再具有任何意义:
The GNU tools also still support names from the deprecated legacy APCS as identifiers for the given register numbers, even though they no longer necessarily have any meaning:
- FP (r11):帧指针 - 对于 ARM 代码可能仍然适用;Thumb 代码倾向于将实际的帧指针保存在 r7 中,当然,代码编译时可能根本没有帧指针,在这种情况下,fp"只是另一个被调用者保存的通用寄存器.
- SL (r10):堆栈限制 - 我实际上不知道那个限制的历史,但在大多数现代代码中,r10 并不比 r4-r8 更特殊.
请注意,r9 不一定是通用寄存器——EABI 将其保留用于特定于平台的目的.在 linux-gnueabi 下没有什么特别的,但其他平台可能会将它用于特殊目的,例如 TLS 或全局对象表指针,因此它也可能通过 SB(静态基)或 TR(线程寄存器).
Note that r9 is not necessarily a general-purpose register - the EABI reserves it for platform-specific purposes. Under linux-gnueabi it's nothing special, but other platforms may use it for special purposes like a TLS or global object table pointer, so it may also go by SB (static base) or TR (thread register).
* PC 相关分支指令的有限范围背后的故事——如果链接器发现调用的目标最终超过 32MB,它可能会生成一个中间代码(一些额外的指令在调用站点)作为分支目标,计算实际地址并执行绝对分支,为此它可能需要临时寄存器.
这篇关于Android CPU 寄存器名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!