Mercurial > pub > dyncall > dyncall
comparison doc/manual/callconvs/callconv_ppc64.tex @ 473:ead041d93e36
- ppc doc and disas examples related to aggregates
author | Tassilo Philipp |
---|---|
date | Wed, 16 Feb 2022 16:44:11 +0100 |
parents | b47168dacba6 |
children | fc614cb865c6 |
comparison
equal
deleted
inserted
replaced
472:e5820b7a3fbc | 473:ead041d93e36 |
---|---|
1 %////////////////////////////////////////////////////////////////////////////// | 1 %////////////////////////////////////////////////////////////////////////////// |
2 % | 2 % |
3 % Copyright (c) 2007-2019 Daniel Adler <dadler@uni-goettingen.de>, | 3 % Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>, |
4 % Tassilo Philipp <tphilipp@potion-studios.com> | 4 % Tassilo Philipp <tphilipp@potion-studios.com> |
5 % | 5 % |
6 % Permission to use, copy, modify, and distribute this software for any | 6 % Permission to use, copy, modify, and distribute this software for any |
7 % purpose with or without fee is hereby granted, provided that the above | 7 % purpose with or without fee is hereby granted, provided that the above |
8 % copyright notice and this permission notice appear in all copies. | 8 % copyright notice and this permission notice appear in all copies. |
24 | 24 |
25 \paragraph{Overview} | 25 \paragraph{Overview} |
26 | 26 |
27 \begin{itemize} | 27 \begin{itemize} |
28 \item Word size is 32 bits for historical reasons | 28 \item Word size is 32 bits for historical reasons |
29 \item Doublework size is 64 bits. | |
29 \item Big endian (MSB) and litte endian (LSB) operating modes. | 30 \item Big endian (MSB) and litte endian (LSB) operating modes. |
30 \item Apple Mac OS X/Darwin PPC is specified in "Mac OS X ABI Function Call Guide"\cite{ppcMacOSX}. It uses Big Endian (MSB). | 31 \item Apple Mac OS X/Darwin PPC is specified in "Mac OS X ABI Function Call Guide"\cite{ppcMacOSX}. It uses Big Endian (MSB). |
31 \item Linux PPC 64-bit ABI is specified in "64-bit PowerPC ELF Application Binary Interface Supplement"\cite{ppcelf64abi} which is based on "System V ABI". | 32 \item Linux PPC 64-bit ABI is specified in "64-bit PowerPC ELF Application Binary Interface Supplement"\cite{ppcelf64abi} which is based on "System V ABI". |
32 \end{itemize} | 33 \end{itemize} |
33 | 34 |
101 \item space for all potential gpr* register passed arguments is reserved in the stack parameter area (in order to spill the parameters if | 102 \item space for all potential gpr* register passed arguments is reserved in the stack parameter area (in order to spill the parameters if |
102 needed - e.g. varargs), meaning a minimum of 64 bytes to hold gpr3-gpr10 | 103 needed - e.g. varargs), meaning a minimum of 64 bytes to hold gpr3-gpr10 |
103 \item all nonvector parameters are aligned on 8-byte boundaries | 104 \item all nonvector parameters are aligned on 8-byte boundaries |
104 \item vector parameters are aligned on 16-byte boundaries | 105 \item vector parameters are aligned on 16-byte boundaries |
105 \item integer parameters \textless\ 64 bit are right-justified (meaning occupy higher-address bytes) in their 8-byte slot on the stack, requiring extra-care for big-endian targets | 106 \item integer parameters \textless\ 64 bit are right-justified (meaning occupy higher-address bytes) in their 8-byte slot on the stack, requiring extra-care for big-endian targets |
107 \item aggregates (struct, union) are passed as a sequence of doublewords (following above rules for doublewords) | |
106 \end{itemize} | 108 \end{itemize} |
107 | 109 |
108 | 110 |
109 \paragraph{Return values} | 111 \paragraph{Return values} |
110 | 112 |
111 \begin{itemize} | 113 \begin{itemize} |
112 \item return values of integer \textless=\ 32bit or pointer type use gpr3 and are zero or sign extended depending on their type | 114 \item return values of integer \textless=\ 32bit or pointer type use gpr3 and are zero or sign extended depending on their type |
113 \item 64 bit integers use gpr3 | 115 \item 64 bit integers use gpr3 |
114 \item floating point values are returned via fpr1 | 116 \item floating point values are returned via fpr1 |
115 \item character arrays \textless=\ 8 bytes use gpr3, and are right justified | 117 \item for aggregates (struct, union) of any size, a secret first parameter with an address |
116 \item for all structs/unions (regardless of size) or character arrays \textgreater\ 8 bytes, a secret first parameter with an address to a caller allocated space is passed as first argument to the function (meaning in gpr3), which is written to by the callee | 118 to a caller allocated space is passed to the function (in gpr3), which is written to by the callee |
117 \end{itemize} | 119 \end{itemize} |
118 | 120 |
119 | 121 |
120 \paragraph{Stack layout} | 122 \paragraph{Stack layout} |
121 | 123 |