Android CPU register names?

ⅰ亾dé卋堺 提交于 2019-12-03 14:28:14

The current ARM EABI procedure call standard outlines the standard 'special' names for r12-r15:

  • PC (r15): Program counter
  • LR (r14): Link register
  • SP (r13): Stack pointer
  • IP (r12): Intra-procedure scratch register*

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): Frame pointer - may still be true for ARM code; Thumb code tends to keep actual frame pointers in r7, and of course the code may be compiled without frame pointers at all, in which cases "fp" is just another callee-saved general register.
  • SL (r10): Stack limit - I don't actually know the history of that one, but in most modern code r10 is no more special than r4-r8.

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).

* The story behind that the limited range of the PC-relative branch instructions - if the linker finds the target of a call ends up more than 32MB away, it may generate a veneer (some extra instructions within range of the call site) as the branch target, that computes the real address and performs an absolute branch, for which it may need a scratch register.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!