Mercurial > pub > dyncall > dyncall
annotate doc/manual/callconvs/callconv_ppc32.tex @ 345:c607d67cd6b8 r1.1-RC2
- doc: added syscall info to appendix, fixed broken literature link
- cleanup, added missing forward declarations, ...
author | Tassilo Philipp |
---|---|
date | Tue, 07 Jan 2020 21:52:57 +0100 |
parents | 74c056b597b7 |
children | 06c9adae114d |
rev | line source |
---|---|
0 | 1 %////////////////////////////////////////////////////////////////////////////// |
2 % | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
3 % Copyright (c) 2007-2019 Daniel Adler <dadler@uni-goettingen.de>, |
0 | 4 % Tassilo Philipp <tphilipp@potion-studios.com> |
5 % | |
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 | |
8 % copyright notice and this permission notice appear in all copies. | |
9 % | |
10 % THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 % WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 % MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 % ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 % WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 % ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 % OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 % | |
18 %////////////////////////////////////////////////////////////////////////////// | |
19 | |
20 % ================================================== | |
21 % PowerPC 32 | |
22 % ================================================== | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
23 \subsection{PowerPC (32bit) Calling Conventions} |
0 | 24 |
25 \paragraph{Overview} | |
26 | |
27 \begin{itemize} | |
28 \item Word size is 32 bits | |
29 \item Big endian (MSB) and litte endian (LSB) operating modes. | |
30 \item Processor operates on floats in double precision floating point arithmetc (IEEE-754) values directly (single precision is converted on the fly) | |
331 | 31 \item Apple macos/Mac OS X/Darwin PPC is specified in "Mac OS X ABI Function Call Guide"\cite{ppcMacOSX}. It uses Big Endian (MSB) |
32 \item Linux PPC 32-bit ABI is specified in "LSB for PPC"\cite{ppc32LSB} which is based on "System V ABI". It uses Big Endian (MSB) | |
33 \item PowerPC EABI is defined in the "PowerPC Embedded Application Binary Interface 32-Bit Implementation"\cite{ppceabi} | |
34 \item There is also the "PowerOpen ABI"\cite{poabi}, a nearly identical version of it is used in AIX % more info: http://www.ingallegri.com/public/ppc.html | |
0 | 35 \end{itemize} |
36 | |
37 \paragraph{\product{dyncall} support} | |
38 | |
345
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
39 \product{Dyncall} and \product{dyncallback} are supported for PowerPC (32bit) |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
40 Big Endian (MSB), for Darwin's and System V's calling convention.\\ |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
41 \product{Dyncall} can also be used to issue syscalls by using the syscall |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
42 number as target parameter and selecting the correct mode. |
0 | 43 |
44 | |
45 \subsubsection{Mac OS X/Darwin} | |
46 | |
47 \paragraph{Registers and register usage} | |
48 | |
49 \begin{table}[h] | |
77 | 50 \begin{tabular*}{0.95\textwidth}{3 B} |
0 | 51 Name & Brief description\\ |
52 \hline | |
53 {\bf gpr0} & scratch\\ | |
54 {\bf gpr1} & stack pointer\\ | |
55 {\bf gpr2} & scratch\\ | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
56 {\bf gpr3,gpr4} & return value, parameter 0 and 1 for integer or pointer, scratch\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
57 {\bf gpr5-gpr10} & parameter 2-7 for integer or pointer parameters, scratch\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
58 {\bf gpr11} & preserve\\ |
0 | 59 {\bf gpr12} & branch target for dynamic code generation\\ |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
60 {\bf gpr13-31} & preserve\\ |
0 | 61 {\bf fpr0} & scratch\\ |
238 | 62 {\bf fpr1} & floating point return value, floating point parameter 0 (always double precision)\\ |
63 {\bf fpr2-fpr13} & floating point parameters 1-12 (always double precision)\\ | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
64 {\bf fpr14-fpr31} & preserve\\ |
0 | 65 {\bf v0-v1} & scratch\\ |
66 {\bf v2-v13} & vector parameters\\ | |
67 {\bf v14-v19} & scratch\\ | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
68 {\bf v20-v31} & preserve\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
69 {\bf lr} & link-register, scratch\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
70 {\bf ctr} & count-register, scratch\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
71 {\bf cr0-cr7} & conditional register fields, each 4-bit wide (cr0-cr1 and cr5-cr7 are scratch)\\ |
76 | 72 \end{tabular*} |
0 | 73 \caption{Register usage on Darwin PowerPC 32-Bit} |
74 \end{table} | |
75 | |
76 \paragraph{Parameter passing} | |
77 | |
78 \begin{itemize} | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
79 \item stack grows down |
238 | 80 \item stack parameter order: right-to-left |
81 \item caller cleans up the stack | |
0 | 82 \item the first 8 integer parameters are passed in registers gpr3-gpr10 |
331 | 83 \item the first 13 floating point parameters are passed in registers fpr1-fpr13 |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
84 \item 64 bit arguments are passed as if they were two 32 bit arguments, without skipping registers for alignment (this means passing half via a register and half via the stack is allowed) |
0 | 85 \item if a float parameter is passed via a register, gpr registers are skipped for subsequent integer parameters (based on the size of |
86 the float - 1 register for single precision and 2 for double precision floating point values) | |
87 \item the caller pushes subsequent parameters onto the stack | |
88 \item for every parameter passed via a register, space is reserved in the stack parameter area (in order to spill the parameters if | |
89 needed - e.g. varargs) | |
331 | 90 \item ellipsis calls take floating point values in int and float registers (single precision floats are promoted to double precision as |
91 required by ellipsis calls) | |
0 | 92 \item all nonvector parameters are aligned on 4-byte boundaries |
93 \item vector parameters are aligned on 16-byte boundaries | |
94 \item composite parameters with size of 1 or 2 bytes occupy low-order bytes of their 4-byte area. INCONSISTENT with other 32-bit PPC | |
331 | 95 binary interfaces. In AIX and mac OS 9, padding bytes always follow the data structure |
0 | 96 \item composite parameters 3 bytes or larger in size occupy high-order bytes |
125 | 97 \item integer parameters \textless\ 32 bit are right-justified (meaning occupy higher-address bytes) in their 4-byte slot on the stack, requiring extra-care for big-endian targets |
0 | 98 \end{itemize} |
99 | |
100 | |
101 \paragraph{Return values} | |
102 | |
103 \begin{itemize} | |
104 \item return values of integer \textless=\ 32bit or pointer type use gpr3 | |
105 \item 64 bit integers use gpr3 and gpr4 (hiword in gpr3, loword in gpr4) | |
106 \item floating point values are returned via fpr1 | |
107 \item structures \textless=\ 64 bits use gpr3 and gpr4 | |
108 \item for types \textgreater\ 64 bits, a secret first parameter with an address to the return value is passed | |
109 \end{itemize} | |
110 | |
111 | |
112 \paragraph{Stack layout} | |
113 | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
114 % verified/amended: TP nov 2019 (see also doc/disas_examples/ppc.darwin.disas) |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
115 Stack frame is always 16-byte aligned. Prolog opens frame with additional, fixed space for a linkage area, to hold a number of values (not all of them are required to be saved, though). Stack directly after function prolog:\\ |
0 | 116 |
117 \begin{figure}[h] | |
118 \begin{tabular}{5|3|1 1} | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
119 & \vdots & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
120 \hhline{~=~~} |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
121 register save area & \hspace{4cm} & & \mrrbrace{14}{caller's frame} \\ |
0 | 122 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
123 local data & & & \\ |
0 | 124 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
125 \mrlbrace{6}{parameter area} & last arg & \mrrbrace{3}{stack parameters} & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
126 & \ldots & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
127 & 9th word of arg data & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
128 & gpr10 & \mrrbrace{3}{spill area (as needed)} & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
129 & \ldots & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
130 & gpr3 & & \\ |
0 | 131 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
132 \mrlbrace{6}{linkage area} & reserved & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
133 & reserved & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
134 & reserved & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
135 & return address (callee saved) & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
136 & condition reg (callee saved) & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
137 & parent stack frame pointer & & \\ |
0 | 138 \hhline{~=~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
139 register save area & & & \mrrbrace{4}{current frame} \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
140 \hhline{~-~~} |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
141 local data & & & \\ |
0 | 142 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
143 parameter area & & & \\ |
0 | 144 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
145 linkage area & \vdots & & \\ |
0 | 146 \end{tabular} |
147 \caption{Stack layout on ppc32 Darwin} | |
148 \end{figure} | |
149 | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
150 |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
151 \newpage |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
152 |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
153 |
0 | 154 \subsubsection{System V PPC 32-bit} |
155 | |
156 \paragraph{Status} | |
157 | |
158 \paragraph{Registers and register usage} | |
159 | |
160 \begin{table}[h] | |
77 | 161 \begin{tabular*}{0.95\textwidth}{3 B} |
76 | 162 Name & Brief description\\ |
0 | 163 \hline |
164 {\bf r0} & scratch\\ | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
165 {\bf r1} & stack pointer, preserve\\ |
0 | 166 {\bf r2} & system-reserved\\ |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
167 {\bf r3-r4} & parameter passing and return value, scratch\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
168 {\bf r5-r10} & parameter passing, scratch\\ |
0 | 169 {\bf r11-r12} & scratch\\ |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
170 {\bf r13} & small data area pointer register\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
171 {\bf r14-r30} & local variables, preserve\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
172 {\bf r31} & used for local variables or \emph{environment pointer}, preserve\\ |
0 | 173 {\bf f0} & scratch\\ |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
174 {\bf f1} & parameter passing and return value, scratch\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
175 {\bf f2-f8} & parameter passing, scratch\\ |
0 | 176 {\bf f9-13} & scratch\\ |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
177 {\bf f14-f31} & local variables, preserve\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
178 {\bf cr0-cr7} & conditional register fields, each 4-bit wide (cr0-cr1 and cr5-cr7 are scratch)\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
179 {\bf lr} & link register, scratch\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
180 {\bf ctr} & count register, scratch \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
181 {\bf xer} & fixed-point exception register, scratch\\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
182 {\bf fpscr} & floating-point Status and Control Register\\ |
0 | 183 % {\bf v0-v1} & scratch\\ |
184 % {\bf v2-v13} & vector parameters\\ | |
185 % {\bf v14-v19} & scratch\\ | |
186 % {\bf v20-v31} & permanent\\ | |
187 % {\bf lr} & scratch, link-register\\ | |
188 % {\bf ctr} & scratch, count-register\\ | |
189 % {\bf cr0-cr1} & scratch\\ | |
190 % {\bf cr2-cr4} & permanent\\ | |
191 % {\bf cr5-cr7} & scratch\\ | |
76 | 192 \end{tabular*} |
0 | 193 \caption{Register usage on System V ABI PowerPC Processor} |
194 \end{table} | |
195 | |
196 \paragraph{Parameter passing} | |
197 | |
198 \begin{itemize} | |
199 \item Stack pointer (r1) is always 16-byte aligned. The EABI differs here - it is 8-byte alignment. | |
200 \item 8 general-purpose registers (r3-r10) for integer and pointer types. | |
201 \item 8 floating-pointer registers (f1-f8) for float (promoted to double) and double types. | |
202 \item Additional arguments are passed on the stack directly after the back-chain and saved return address (8 bytes structure) on the callers stack frame. | |
203 \item 64-bit integer data types are passed in general-purpose registers as a whole in two | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
204 32-bit general purpose registers (an odd and an even e.g. r3 and r4), skipping an even integer register |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
205 or passed on the stack; they are never splitted into a register and stack part |
0 | 206 \item Ellipse calls set CR bit 6 |
123 | 207 \item integer parameters \textless\ 32 bit are right-justified (meaning occupy high-order bytes) in their 4-byte area, requiring extra-care for big-endian targets |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
208 \item no spill area is used on stack, iterating over varargs requires a specific va\_list implementation |
0 | 209 \end{itemize} |
210 | |
211 \paragraph{Return values} | |
212 | |
213 \begin{itemize} | |
214 \item 32-bit integers use register r3, 64-bit use registers r3 and r4 (hiword in r3, loword in r4). | |
215 \item floating-point values are returned using register f1. | |
216 \end{itemize} | |
217 | |
218 | |
219 \paragraph{Stack layout} | |
220 | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
221 % verified/amended: TP nov 2019 (see also doc/disas_examples/ppc.sysv.disas) |
0 | 222 Stack frame is always 16-byte aligned. Stack directly after function prolog:\\ |
223 | |
224 \begin{figure}[h] | |
225 \begin{tabular}{5|3|1 1} | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
226 & \vdots & & \\ |
0 | 227 \hhline{~=~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
228 register save area & \hspace{4cm} & & \mrrbrace{7}{caller's frame} \\ |
0 | 229 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
230 local data & & & \\ |
0 | 231 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
232 \mrlbrace{3}{parameter area} & last arg & \mrrbrace{3}{stack parameters} & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
233 & \ldots & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
234 & first arg passed via stack & & \\ |
0 | 235 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
236 & return address (callee saved) & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
237 \hhline{~-~~} |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
238 & parent stack frame pointer & & \\ |
0 | 239 \hhline{~=~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
240 register save area & & & \mrrbrace{4}{current frame} \\ |
0 | 241 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
242 local data & & & \\ |
0 | 243 \hhline{~-~~} |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
244 parameter area & & & \\ |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
245 \hhline{~-~~} |
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
246 & \vdots & & \\ |
0 | 247 \end{tabular} |
248 \caption{Stack layout on System V ABI for PowerPC 32-bit calling convention} | |
249 \end{figure} | |
328
276eb8c87aa0
- review and fixes, cleanup, amendments to calling convention appendix of manual
Tassilo Philipp
parents:
241
diff
changeset
|
250 |
345
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
251 |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
252 \newpage |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
253 |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
254 \subsubsection{System V syscalls} |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
255 |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
256 \paragraph{Parameter passing} |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
257 |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
258 \begin{itemize} |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
259 \item syscall is issued via the {\em sc} instruction |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
260 \item kernel destroys registers r13 |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
261 \item syscall number is set in r0 |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
262 \item params are passed in registers r3 through r10 |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
263 \item no stack in use, meaning syscalls are in theory limited to eight arguments |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
264 \item register r3 holds the return value, overflow flag in conditional register cr0 signals errors in syscall |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
265 \end{itemize} |
c607d67cd6b8
- doc: added syscall info to appendix, fixed broken literature link
Tassilo Philipp
parents:
331
diff
changeset
|
266 |