Mercurial > pub > dyncall > dyncall
comparison doc/manual/callconvs/callconv_sparc.tex @ 157:49549739228c
- sparc callback asm and args code (still some stack alignment issues, currently)
- doc improvements for sparc callconv
author | cslag |
---|---|
date | Wed, 28 Dec 2016 16:48:35 -0600 |
parents | 9e99918065e6 |
children | 164cf1663b7c |
comparison
equal
deleted
inserted
replaced
156:9e4f1355a388 | 157:49549739228c |
---|---|
34 | 34 |
35 \begin{itemize} | 35 \begin{itemize} |
36 \item 32 32-bit integer/pointer registers | 36 \item 32 32-bit integer/pointer registers |
37 \item 32 floating point registers (usable as 8 quad precision, 16 double precision or 32 single precision registers) | 37 \item 32 floating point registers (usable as 8 quad precision, 16 double precision or 32 single precision registers) |
38 \item 32 registers are accessible at a time (8 are global ones (g*), whereas the rest forms a register window with 8 input (i*), 8 output (o*) and 8 local (l*) ones) | 38 \item 32 registers are accessible at a time (8 are global ones (g*), whereas the rest forms a register window with 8 input (i*), 8 output (o*) and 8 local (l*) ones) |
39 \item invoking a function shifts the register window, the old output registers become the new input registers (old local and input ones are not accessible anymore) | 39 \item calling a function shifts the register window, the old output registers become the new input registers (old local and input ones are not accessible anymore) |
40 \end{itemize} | 40 \end{itemize} |
41 | 41 |
42 \begin{table}[h] | 42 \begin{table}[h] |
43 \begin{tabular*}{0.95\textwidth}{lll} | 43 \begin{tabular*}{0.95\textwidth}{lll} |
44 Name & Alias & Brief description\\ | 44 Name & Alias & Brief description\\ |
53 \caption{Register usage on sparc calling convention} | 53 \caption{Register usage on sparc calling convention} |
54 \end{table} | 54 \end{table} |
55 | 55 |
56 \paragraph{Parameter passing} | 56 \paragraph{Parameter passing} |
57 \begin{itemize} | 57 \begin{itemize} |
58 \item Stack parameter order: right-to-left | 58 \item stack grows down |
59 \item Caller cleans up the stack @@@ really? | 59 \item stack parameter order: right-to-left |
60 \item Stack always aligned to 8 bytes. | 60 \item caller cleans up the stack |
61 \item stack always aligned to 8 bytes | |
61 \item first 6 integers and floats are passed independently in registers using \%o0-\%o5 | 62 \item first 6 integers and floats are passed independently in registers using \%o0-\%o5 |
62 \item for every other argument the stack is used | 63 \item for every other argument the stack is used |
63 \item @@@ what about floats, 64bit integers, etc.? | 64 \item all arguments <= 32 bit are passed as 32 bit values |
64 \item results are returned in \%i0, and structs/unions pass a pointer to them as a hidden stack parameter (see below) | 65 \item 64 bit arguments are passed like two consecutive <= 32 bit values |
66 \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 | |
67 \item if needed, register spill area is adjacent to parameters | |
68 \item results are expected by caller to be returned in \%o0\%o1 (after reg window restore, meaning callee writes to \%i0\%i1) for integers, \%f0/\%f1 for floats, and for structs/unions a pointer to them is used as a hidden stack parameter (see below) | |
65 \end{itemize} | 69 \end{itemize} |
66 | 70 |
67 \paragraph{Stack layout} | 71 \paragraph{Stack layout} |
68 | 72 |
69 Stack directly after function prolog:\\ | 73 Stack directly after function prolog:\\ |