Reputation: 61378
On iPhone/ARM, which CPU registers are functions supposed to preserve, if any?
Upvotes: 1
Views: 1252
Reputation: 7897
Old, but incorrect answer. Wikipedia is often inaccurate (sometimes downright incorrect), and this is an example of the former case. There is a generic calling convention (which is what Wikipedia documents), but OSes can deviate - both Android and iOS do (and likely Win 8 will, but we'll know that when the binaries start surfacing)
http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iPhoneOSABIReference/Introduction/Introduction.html provides the correct spec for iOS, so no sense in repeating here. Most notably, note the use of r7 and r12. Also note that ARMv6 and ARMv7 are different. By now, you want ARMv7 architectures (A4,5,6..)
Upvotes: 3
Reputation: 299345
Wikipedia's article on Calling Convention has a good summary of the conventions for ARM.
Upvotes: 1