This preview shows page 1. Sign up to view the full content.
Unformatted text preview: s. Two ways to pass floating-point arguments. The ARM floating-point architecture (see Section 6.4 on page 163) specifies a set of eight floating-point registers. The APCS can use these to pass floating-point arguments into functions, and this is the most efficient solution when the system makes extensive use of floating-point variables. If, however, the system makes little or no use of floating-point types (and many ARM systems do not) this approach incurs a small overhead which is avoided by passing floating-point arguments in the integer registers and/or on the stack. Re-entrant or non-re-entrant code. Code specified as re-entrant is position-independent and addresses all data indirectly through the static base register (sb). This code can be placed in a ROM and Functions and procedures 179 can be shared by several client processes. Generally, code to be placed in a ROM or a shared library should be re-entrant whereas application code will not be. Argumen t passing A C function may have many (or even a variable number of) arguments. The APCS organizes the arguments as follows: 1. If floating-point values are passed through floating-point registers, the first four floating-point arguments are loaded into the first four floating-point registers. 2. All remaining arguments are organized into a list of words; the first four words are loaded into al to a4, then the remaining words are pushed onto the stack in reverse order. Note that multi-word arguments, including double precision floating-point values, may be passed in integer registers, on the stack, or even split across the registers and the stack. Result return A simple result (such as an integer) is returned through al. A more complex result is returned in memory to a location specified by an address which is effectively passed as an additional first argument to the function through al. A simple leaf function which can perform all its functions using only al to a4 can be compiled into code with a minimal calling overhead: Function entry and exit In typical progr...
View Full Document
This document was uploaded on 10/30/2011 for the course CSE 378 380 at SUNY Buffalo.
- Spring '09