comparison doc/manual/callconvs/callconv_arm32.tex @ 41:00310bf92924

- doc - source consistency tweak
author cslag
date Fri, 18 Dec 2015 23:10:37 +0100
parents 61edd9cf8026
children ecc9403e214a
comparison
equal deleted inserted replaced
40:02223f76d319 41:00310bf92924
226 \subsubsection{EABI (ARM and THUMB mode)} 226 \subsubsection{EABI (ARM and THUMB mode)}
227 227
228 228
229 The ARM EABI is very similar to the ABI outlined in ARM-THUMB procedure call 229 The ARM EABI is very similar to the ABI outlined in ARM-THUMB procedure call
230 standard (ATPCS) \cite{ATPCS} - however, the EABI requires the stack to be 230 standard (ATPCS) \cite{ATPCS} - however, the EABI requires the stack to be
231 8-byte aligned at function entries, as well as 64 bit parameters. The latter 231 8-byte aligned at function entries, as well as for 64 bit parameters. The latter
232 are aligned on 8-byte boundaries on the stack and 2-registers for parameters 232 are aligned on 8-byte boundaries on the stack and 2-registers for a parameter
233 passed via register. In order to achieve such an alignment, a register might 233 passed via register. In order to achieve such an alignment, a register might
234 have to be skipped for parameters passed via registers, or 4-bytes on the stack 234 have to be skipped for parameters passed via registers, or 4-bytes on the stack
235 for parameters passed via the stack. Refer to the Debian ARM EABI port wiki 235 for parameters passed via the stack. Refer to the Debian ARM EABI port wiki
236 for more information \cite{armeabi}. 236 for more information \cite{armeabi}.
237 237
291 291
292 \subsubsection{ARM hard float (armhf)} 292 \subsubsection{ARM hard float (armhf)}
293 293
294 294
295 Most debian-based Linux systems on ARMv7 (or ARMv6 with FPU) platforms use a calling convention referred to 295 Most debian-based Linux systems on ARMv7 (or ARMv6 with FPU) platforms use a calling convention referred to
296 as armhf, using 16 64-bit floating point registers of the FPU of the VFPv3-D16 extension to the ARM architecture. 296 as armhf, using 16 32-bit floating point registers of the FPU of the VFPv3-D16 extension to the ARM architecture.
297 The instruction set used for armhf is Thumb-2. Refer to the debian wiki for more information \cite{armhf}. 297 The instruction set used for armhf is Thumb-2. Refer to the debian wiki for more information \cite{armhf}.
298 298
299 Code is little-endian, rest is similar to EABI, 8-byte aligned stack, etc.. 299 Code is little-endian, rest is similar to EABI with an 8-byte aligned stack, etc..
300 300
301 \paragraph{Register usage} 301 \paragraph{Register usage}
302 302
303 \begin{table}[h] 303 \begin{table}[h]
304 \begin{tabular}{3 B} 304 \begin{tabular}{3 B}
331 331
332 \begin{itemize} 332 \begin{itemize}
333 \item stack parameter order: right-to-left 333 \item stack parameter order: right-to-left
334 \item caller cleans up the stack 334 \item caller cleans up the stack
335 \item first four non-floating-point words are passed using r0-r3 335 \item first four non-floating-point words are passed using r0-r3
336 \item first 16 single-precision, or 8 double-precision arguments are passed via s0-s15 or d0-d7, respectively 336 \item first 16 single-precision, or 8 double-precision arguments are passed via s0-s15 or d0-d7, respectively (note that since s and d registers are aliased, already used ones are skipped)
337 \item subsequent parameters are pushed onto the stack (in right to left order, such that the stack pointer points to the first of the remaining parameters) 337 \item subsequent parameters are pushed onto the stack (in right to left order, such that the stack pointer points to the first of the remaining parameters)
338 \item if the callee takes the address of one of the parameters and uses it to address other parameters (e.g. varargs) it has to copy - in its prolog - the first four words to a reserved stack area adjacent to the other parameters on the stack @@@?check doc 338 \item if the callee takes the address of one of the parameters and uses it to address other parameters (e.g. varargs) it has to copy - in its prolog - the first four words to a reserved stack area adjacent to the other parameters on the stack @@@?check spilling of float args, also
339 \item parameters \textless=\ 32 bits are passed as 32 bit words 339 \item parameters \textless=\ 32 bits are passed as 32 bit words
340 \item 64 bit parameters are passed as two 32 bit parts (even partly via the register and partly via the stack, although this doesn't seem to be specified in the ATPCS), with the loword coming first @@@?check doc
341 \item structures and unions are passed by value, with the first four words of the parameters in r0-r3 @@@?check doc 340 \item structures and unions are passed by value, with the first four words of the parameters in r0-r3 @@@?check doc
342 \item if return value is a structure, a pointer pointing to the return value's space is passed in r0, the first parameter in r1, etc. (see {\bf return values}) 341 \item if return value is a structure, a pointer pointing to the return value's space is passed in r0, the first parameter in r1, etc. (see {\bf return values})
343 \end{itemize} 342 \end{itemize}
344 343
345 \paragraph{Return values} 344 \paragraph{Return values}