Mercurial > pub > dyncall > dyncall
comparison doc/manual/callconvs/callconv_sparc32.tex @ 476:c73c59c8b553
- sparc32 doc clarifications w/ respect to aggregate passing and returning
author | Tassilo Philipp |
---|---|
date | Sat, 19 Feb 2022 19:54:20 +0100 |
parents | 4e6f63b7020e |
children | fc614cb865c6 |
comparison
equal
deleted
inserted
replaced
475:5be9f5ccdd35 | 476:c73c59c8b553 |
---|---|
1 %////////////////////////////////////////////////////////////////////////////// | 1 %////////////////////////////////////////////////////////////////////////////// |
2 % | 2 % |
3 % Copyright (c) 2012-2019 Daniel Adler <dadler@uni-goettingen.de>, | 3 % Copyright (c) 2012-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. |
61 \begin{itemize} | 61 \begin{itemize} |
62 \item stack grows down | 62 \item stack grows down |
63 \item stack parameter order: right-to-left | 63 \item stack parameter order: right-to-left |
64 \item caller cleans up the stack | 64 \item caller cleans up the stack |
65 \item stack always aligned to 8 bytes | 65 \item stack always aligned to 8 bytes |
66 \item first 6 integers and floats are passed independently in registers using \%o0-\%o5 | 66 \item first 6 integers/pointers and floats are passed independently in registers using \%o0-\%o5 |
67 \item for every other argument the stack is used | 67 \item for every other argument the stack is used |
68 \item all arguments \textless=\ 32 bit are passed as 32 bit values | 68 \item all arguments \textless=\ 32 bit are passed as 32 bit values |
69 \item 64 bit arguments are passed like two consecutive \textless=\ 32 bit values (which allows for an argument to be split between the stack and \%i5) | 69 \item 64 bit arguments are passed like two consecutive \textless=\ 32 bit values (which allows for an argument to be split between the stack and \%i5) |
70 \item aggregates (struct, union) of any size, as well as quad precision values are passed indirectly as a pointer to a {\bf copy} of the aggregate (like: struct s2 = s; callee(\&s2);) | |
70 \item minimum stack size is 64 bytes, b/c stack pointer must always point at enough space to store all \%i* and \%l* registers, used when running out of register windows | 71 \item minimum stack size is 64 bytes, b/c stack pointer must always point at enough space to store all \%i* and \%l* registers, used when running out of register windows |
71 \item if needed, register spill area is adjacent to parameters | 72 \item if needed, register spill area is adjacent to parameters |
72 \end{itemize} | 73 \end{itemize} |
73 | 74 |
74 \paragraph{Return values} | 75 \paragraph{Return values} |
75 | 76 |
76 \begin{itemize} | 77 \begin{itemize} |
77 \item results are expected by caller to be returned in \%o0/\%o1 (after reg window restore, meaning callee writes to \%i0/\%i1) for integers | 78 \item results are expected by caller to be returned in \%o0/\%o1 (after reg window restore, meaning callee writes to \%i0/\%i1) for integers |
78 \item \%f0/\%f1 are used for floating point values | 79 \item \%f0/\%f1 are used for floating point values |
79 \item structs/unions are returned in a space allocated by the caller, with a pointer to it passed as a {\bf additional}, hidden stack parameter (see below) | 80 \item aggregates (struct, union) and quad precision values are returned in a space allocated by the caller, with a pointer to it passed |
81 as an {\bf additional}, hidden {\bf stack} parameter (always at \%sp+64 for the caller, see below); that pointer is returned in \%o0 | |
80 \end{itemize} | 82 \end{itemize} |
81 | 83 |
82 \paragraph{Stack layout} | 84 \paragraph{Stack layout} |
83 | 85 |
84 % verified/amended: TP nov 2019 (see also doc/disas_examples/sparc.sparc.disas) | 86 % verified/amended: TP nov 2019 (see also doc/disas_examples/sparc.sparc.disas) |