changeset 467:b47168dacba6

manual: - adding aggregate passing and returning info for x64 (win and sysv, however, *only* w/ respect to types supported by dyncall) - python binding text cleanup and sync with current binding version - added suite_aggrs description and cleaned up other test suite descriptions a bit - update list of calling convention modes - cleanup and minor other fixes (e.g. changed \newpage in many places to \clearpage to avoid hitting float limit, crlf->cr, ...)
author Tassilo Philipp
date Fri, 04 Feb 2022 23:54:42 +0100
parents ddfb9577a00e
children 79b95db3d68f
files doc/manual/callconvs/callconv_arm32.tex doc/manual/callconvs/callconv_arm64.tex doc/manual/callconvs/callconv_mips32.tex doc/manual/callconvs/callconv_ppc32.tex doc/manual/callconvs/callconv_ppc64.tex doc/manual/callconvs/callconv_x64.tex doc/manual/callconvs/callconv_x86.tex doc/manual/manual.tex doc/manual/manual_bindings.tex doc/manual/manual_build.tex doc/manual/manual_cc.tex doc/manual/manual_design.tex doc/manual/manual_devel.tex doc/manual/manual_dyncall_api.tex doc/manual/manual_dyncallback_api.tex doc/manual/manual_dynload_api.tex doc/manual/manual_epilog.tex doc/manual/manual_literature.tex doc/manual/manual_motivation.tex doc/manual/manual_overview.tex
diffstat 20 files changed, 222 insertions(+), 184 deletions(-) [+]
line wrap: on
line diff
--- a/doc/manual/callconvs/callconv_arm32.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/callconvs/callconv_arm32.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -135,7 +135,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{ATPCS THUMB mode}
@@ -224,7 +224,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{EABI (ARM and THUMB mode)}
@@ -248,7 +248,7 @@
 \end{itemize}
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{ARM on Apple's iOS (Darwin) Platform (ARM and THUMB mode)}
@@ -294,6 +294,8 @@
 \end{itemize}
 
 
+\clearpage
+
 \paragraph{Stack layout}
 
 % verified/amended: TP nov 2019 (see also doc/disas_examples/arm.darwin_{arm,thumb}.disas)
@@ -322,11 +324,11 @@
 \hhline{~-~~}                                                  
 parameter area                           & \vdots               &                                      &                              \\
 \end{tabular}
-\caption{Stack layout on arm32}
+\caption{Stack layout on arm32 (Apple)}
 \end{figure}
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{ARM hard float (armhf)}
@@ -423,7 +425,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{Architectures}
@@ -453,6 +455,3 @@
 \caption{Overview of ARM Architecture, Platforms and Details}
 \end{table}
 
-
-\newpage
-
--- a/doc/manual/callconvs/callconv_arm64.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/callconvs/callconv_arm64.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -125,7 +125,7 @@
 \caption{Stack layout on arm64}
 \end{figure}
 
-\newpage
+\clearpage
 
 
 \subsubsection{Apple's ARM64 Function Calling Convention}
--- a/doc/manual/callconvs/callconv_mips32.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/callconvs/callconv_mips32.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -42,7 +42,7 @@
 (contrary to the like-minded ARM-THUMB, which is supported). Both, calls and callbacks are supported.
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{MIPS EABI 32-bit Calling Convention}
@@ -122,7 +122,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{MIPS O32 32-bit Calling Convention}
@@ -204,5 +204,3 @@
 \caption{Stack layout on MIPS O32 calling convention}
 \end{figure}
 
-\newpage
-
--- a/doc/manual/callconvs/callconv_ppc32.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/callconvs/callconv_ppc32.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -148,7 +148,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{System V PPC 32-bit}
@@ -249,7 +249,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 \subsubsection{System V syscalls}
 
--- a/doc/manual/callconvs/callconv_ppc64.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/callconvs/callconv_ppc64.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -157,7 +157,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 \subsubsection{System V syscalls}
 
--- a/doc/manual/callconvs/callconv_x64.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/callconvs/callconv_x64.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -84,13 +84,14 @@
 \item caller cleans up the stack
 \item first 4 integer/pointer parameters are passed via rcx, rdx, r8, r9 (from left to right), others are pushed on stack (there is a
 spill area for the first 4)
+\item aggregates (structs and unions) \textless\ 64 bits are passed like equal-sized integers
 \item float and double parameters are passed via xmm0l-xmm3l
 \item first 4 parameters are passed via the correct register depending on the parameter type - with mixed float and int parameters,
 some registers are left out (e.g. first parameter ends up in rcx or xmm0, second in rdx or xmm1, etc.)
 \item parameters in registers are right justified
 \item parameters \textless\ 64bits are not zero extended - zero the upper bits contiaining garbage if needed (but they are always
 passed as a qword)
-\item parameters \textgreater\ 64 bit are passed by reference
+\item parameters \textgreater\ 64 bits are passed by reference (for aggregate types, that caller-allocated memory must be 16-byte aligned)
 \item if callee takes address of a parameter, first 4 parameters must be dumped (to the reserved space on the stack) - for
 floating point parameters, value must be stored in integer AND floating point register
 \item caller cleans up the stack, not the callee (like cdecl)
@@ -107,7 +108,8 @@
 \begin{itemize}
 \item return values of pointer or integral type (\textless=\ 64 bits) are returned via the rax register
 \item floating point types are returned via the xmm0 register
-\item for types \textgreater\ 64 bits, a secret first parameter with an address to the return value is passed
+\item aggregates (structs and unions) \textless\ 64 bits are returned via the rax register
+\item for types \textgreater\ 64 bits, a hidden first parameter, with an address to the return value is passed (for C++ thiscalls it is passed as {\bf second} parameter, after the this pointer)
 \end{itemize}
 
 
@@ -148,7 +150,7 @@
 
 
 
-\newpage
+\clearpage
 
 \subsubsection{System V (Linux / *BSD / MacOS X)}
 
@@ -158,7 +160,7 @@
 \begin{tabular*}{0.95\textwidth}{3 B}
 Name                & Brief description\\
 \hline
-{\bf rax}           & scratch, return value\\
+{\bf rax}           & scratch, return value, special use for varargs (in al, see below)\\
 {\bf rbx}           & permanent\\
 {\bf rcx}           & scratch, parameter 3 if integer or pointer\\
 {\bf rdx}           & scratch, parameter 2 if integer or pointer, return value\\
@@ -169,8 +171,8 @@
 {\bf r8-r9}         & scratch, parameter 4 and 5 if integer or pointer\\
 {\bf r10-r11}       & scratch\\
 {\bf r12-r15}       & permanent\\
-{\bf xmm0}          & scratch, floating point parameters 0, floating point return value\\
-{\bf xmm1-xmm7}     & scratch, floating point parameters 1-7\\
+{\bf xmm0-xmm1}     & scratch, floating point parameters 0-1, floating point return value\\
+{\bf xmm2-xmm7}     & scratch, floating point parameters 2-7\\
 {\bf xmm8-xmm15}    & scratch\\
 {\bf st0-st1}       & scratch, 16 byte floating point return value\\
 {\bf st2-st7}       & scratch\\
@@ -186,12 +188,30 @@
 \item first 6 integer/pointer parameters are passed via rdi, rsi, rdx, rcx, r8, r9
 \item first 8 floating point parameters \textless=\ 64 bits are passed via xmm0l-xmm7l
 \item parameters in registers are right justified
-\item parameters that are not passed via registers are pushed onto the stack
+\item parameters that are not passed via registers are pushed onto the stack (with their sizes rounded up to qwords)
 \item parameters \textless\ 64bits are not zero extended - zero the upper bits contiaining garbage if needed (but they are always
 passed as a qword)
 \item integer/pointer parameters \textgreater\ 64 bit are passed via 2 registers
-\item if callee takes address of a parameter, number of used xmm registers is passed silently in al (passed number mustn't be
+\item if callee takes address of a parameter, number of used xmm registers is passed silently in al (passed number doesn't need to be
 exact but an upper bound on the number of used xmm registers)
+\item aggregates (structs, unions (and arrays within those)) follow a more complicated logic (the following {\bf only considers field types supported by dyncall}):
+\begin{itemize}
+  \item aggregates \textgreater\ 16 bytes are always passed entirely via the stack
+  \item for {\it non-trivial} (as defined by the language) C++ aggregates, a pointer to the aggregate is passed, instead
+  \item all other aggregates are classified per qword, by looking at all fields occupying all or part of that qword, recursively
+  \begin{itemize}
+    \item if any field would be passed via the stack, the entire qword will
+    \item otherwise, if any field would be passed like an integer/pointer value, the entire qword will
+    \item otherwise the qword is passed like a floating point value
+  \end{itemize}
+  \item after qword classification, the logic is:
+  \begin{itemize}
+    \item if any qword is classified to be passed via the stack, the entire aggregate will
+    \item if the size of the aggregate is \textgreater\ 2 qwords, it is passed via the stack (except for single floating point values \textgreater\ 128bits)
+    \item all others are passed qword by qword according to their classification, like individual arguments
+	\item however, an aggregate is never split between registers and the stack, if it doesn't fit into available registers it is entirely passed via the stack (freeing such registers for subsequent arguments)
+  \end{itemize}
+\end{itemize}
 \item stack is always 16byte aligned - since return address is 64 bits in size, stacks with an odd number of parameters are
 already aligned
 \item no spill area is used on stack, iterating over varargs requires a specific va\_list implementation
@@ -201,17 +221,26 @@
 \paragraph{Return values}
 
 \begin{itemize}
-\item return values of pointer or integral type (\textless=\ 64 bits) are returned via the rax register
-\item floating point types are returned via the xmm0 register
-\item for types \textgreater\ 64 bits, a secret first parameter with an address to the return value is passed - the passed in address
-will be returned in rax
+\item return values of pointer or integral type are returned via the rax register (and rdx if needed)
+\item floating point types are returned via the xmm0 register (and xmm1 if needed)
+\item aggregates are first classified in the same way as when passing them by value, then:
+\begin{itemize}
+  \item for aggregates that would be passed via the stack, a hidden pointer to a non-shared, caller provided space is {\bf passed} as hidden, first argument; this pointer will be returned via rax
+  \item otherwise, qword by qword is passed, using rax and rdx for integer/pointer qwords, and xmm0 and xmm1 for floating point ones
+\end{itemize}
+\item for aggregates \textgreater\ 128 bits, a secret first parameter with an address to the return value is
+passed (via rdi) - this passed in address will be returned in rax
 \item floating point values \textgreater\ 64 bits are returned via st0 and st1
 \end{itemize}
 
 
 \paragraph{Stack layout}
 
-Stack frame is always 16-byte aligned.
+Stack frame is always 16-byte aligned. A 128 byte large zone beyond the
+location pointed to by the stack pointer is referred to as "red zone",
+considered to be reserved and not be modified by signal or interrupt handlers
+(useful for temporary data not needed to be preserved across calls, and for
+optimizations for leaf functions).
 % verified/amended: TP nov 2019 (see also doc/disas_examples/x64.sysv.disas)
 Stack directly after function prolog:\\
 
@@ -241,7 +270,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 \subsubsection{System V syscalls}
 
--- a/doc/manual/callconvs/callconv_x86.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/callconvs/callconv_x86.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -64,7 +64,7 @@
 the syscall number as target parameter and selecting the correct mode.
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{cdecl}
@@ -140,7 +140,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 
 \subsubsection{MS fastcall}
@@ -538,7 +538,7 @@
 \caption{Register usage on x86 thiscall (MS) calling convention}
 \end{table}
 
-\newpage
+\clearpage
 
 
 \paragraph{Parameter passing}
@@ -737,7 +737,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 \subsubsection{plan9call}
 
@@ -808,7 +808,7 @@
 \end{figure}
 
 
-\newpage
+\clearpage
 
 \subsubsection{Linux syscalls}
 
--- a/doc/manual/manual.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -175,15 +175,15 @@
 
 % main document content -->
 \input{manual_title}
-\newpage
+\clearpage
 \tableofcontents
-\newpage
+\clearpage
 \ifnhtml{
 	\listoftables
 	\listoffigures
 	\lstlistoflistings
 }
-\newpage
+\clearpage
 \input{manual_motivation}
 \input{manual_overview}
 \input{manual_build}
--- a/doc/manual/manual_bindings.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_bindings.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 \section{Bindings to programming languages}
 
 Through binding of the \product{dyncall} library into a scripting environment,
@@ -234,31 +234,31 @@
 \subsection{Python language bindings}
 
 The python module {\tt pydc} implements the Python language bindings,
-namely {\tt load}, {\tt find}, {\tt free}, {\tt call}.
+namely {\tt load}, {\tt find}, {\tt free}, {\tt call}, {\tt new\_callback}, {\tt free\_callback}.
 
 \begin{table}[h]
 \begin{center}
 \begin{tabular*}{0.75\textwidth}{lll}
 Signature character & accepted Python 2 types & accepted Python 3 types \\
 \hline
-\sigchar{v}              & no return type                 & no return type                    \\
-\sigchar{B}              & bool                           & bool                              \\
-\sigchar{c}, \sigchar{C} & int, string (with single char) & int, string (with single char)    \\
-\sigchar{s}, \sigchar{S} & int                            & int                               \\
-\sigchar{i}, \sigchar{I} & int                            & int                               \\
-\sigchar{j}, \sigchar{J} & int                            & int                               \\
-\sigchar{l}, \sigchar{L} & int, long                      & int                               \\
-\sigchar{f}              & float                          & float                             \\
-\sigchar{d}              & double                         & double                            \\
-\sigchar{p}              & bytearray, int, long           & bytearray (mutable in C), int     \\
-\sigchar{Z}              & string, unicode, bytearray     & string, bytearray (all immutable) \\
+\sigchar{v}              & no return type                                     & no return type                                \\
+\sigchar{B}              & bool                                               & bool                                          \\
+\sigchar{c}, \sigchar{C} & int, string (with single char)                     & int, string (with single char)                \\
+\sigchar{s}, \sigchar{S} & int                                                & int                                           \\
+\sigchar{i}, \sigchar{I} & int                                                & int                                           \\
+\sigchar{j}, \sigchar{J} & int                                                & int                                           \\
+\sigchar{l}, \sigchar{L} & int, long                                          & int                                           \\
+\sigchar{f}              & float                                              & float                                         \\
+\sigchar{d}              & float                                              & float                                         \\
+\sigchar{p}              & bytearray, int, long, None, (PyCObject, PyCapsule) & bytearray, int, None, (PyCObject, PyCapsule)  \\
+\sigchar{Z}              & string, unicode, bytearray                         & string, bytes, bytearray                      \\
 \end{tabular*}
 \caption{Type signature encoding for Python bindings}
 \label{Pysigchar}
 \end{center}
 \end{table}
 
-For more details, refer to the README.txt file of the binding.
+This is a very brief description that omits many details. For more, refer to the README.txt file of the binding.
 
 \pagebreak
 
--- a/doc/manual/manual_build.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_build.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 \section{Building the library}
 
 The library has been built and used successfully on several 
--- a/doc/manual/manual_cc.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_cc.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 
 % ==================================================
 % Calling Conventions
@@ -35,14 +35,14 @@
 We strongly advise the reader not to use this document as a general purpose
 calling convention reference.
 
-\input{callconvs/callconv_x86}\newpage
-\input{callconvs/callconv_x64}\newpage
-\input{callconvs/callconv_ppc32}\newpage
-\input{callconvs/callconv_ppc64}\newpage
-\input{callconvs/callconv_arm32}\newpage
-\input{callconvs/callconv_arm64}\newpage
-\input{callconvs/callconv_mips32}\newpage
-\input{callconvs/callconv_mips64}\newpage
-\input{callconvs/callconv_sparc32}\newpage
+\input{callconvs/callconv_x86}\clearpage
+\input{callconvs/callconv_x64}\clearpage
+\input{callconvs/callconv_ppc32}\clearpage
+\input{callconvs/callconv_ppc64}\clearpage
+\input{callconvs/callconv_arm32}\clearpage
+\input{callconvs/callconv_arm64}\clearpage
+\input{callconvs/callconv_mips32}\clearpage
+\input{callconvs/callconv_mips64}\clearpage
+\input{callconvs/callconv_sparc32}\clearpage
 \input{callconvs/callconv_sparc64}
 
--- a/doc/manual/manual_design.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_design.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 \section{Library Design}
 
 
--- a/doc/manual/manual_devel.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_devel.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 \section{Developers}
 
 \subsection{Noteworthy files in the project root}
@@ -45,34 +45,41 @@
 \begin{description}
 
 \item [plain] 
-Simple, identity, unary function calls for all supported return types and
-calling conventions.
+Simple, identity, mostly unary function calls for all supported return types
+and calling conventions. This is not an extensive test suite, but a good place
+to manually test certain cases.
 
 \item [plain\_c++] 
-Similar to plain, but for C++ thiscalls (GNU and MS calling convention).
+Similar to plain, but for C++ thiscalls (in different forms and fashion, with
+aggregates, vararg methots, on x86 with GNU and MS calling convention, etc.).
 
 \item [suite] 
 All combinations of parameter types and counts are tested on void function
-calls. A script written in Python ({\tt mkcase.py}) generates the tests up to
+calls. A Python script ({\tt mkcase.py}) generates the tests up to
 an upper MAXARG limit.
 
 \item [suite\_floats]
 Based on suite. Test double/float variants with up to 10 arguments.
 
+\item [suite\_aggrs]
+Tests passing and returning aggregates by value (struct/union and array members).
+Test cases can be designed in a signature-style format (and random ones generated
+via a Lua script).
+
 \item [suite\_x86win32std] 
 All combinations of parameter types and counts are tested on {\tt \_\_stdcall}
-void function calls. A script written in Python ({\tt mkcase.py}) generates
+void function calls. A Python script ({\tt mkcase.py}) generates
 the tests up to an upper MAXARG limit. This is a x86/Windows only test.
 
 \item [suite\_x86win32fast] 
 All combinations of parameter types and counts are tested on {\tt \_\_fastcall}
 (MS or GNU, depending on the build tool) void function calls.
-A script written in Python ({\tt mkcase.py}) generates the tests up to
+A Python script ({\tt mkcase.py}) generates the tests up to
 an upper MAXARG limit. This is a x86/Windows only test.
 
 \item [ellipsis]
 All combinations of parameter types and counts are tested on void ellipsis 
-function calls. A script written in Python ({\tt mkcase.py}) generates the 
+(vararg) function calls. A Python script ({\tt mkcase.py}) generates the 
 tests up to an upper MAXARG limit.
 
 \item [suite2]
@@ -99,17 +106,19 @@
 \item [call\_suite]
 General purpose test suite combining aspects from all others suites (usually enough for
 testing non-callback calls).
-A script written in Lua generates the tests.
+Test cases can be designed in a signature-style format (and random ones generated
+via a Lua script).
 
 \item [callf]
-Tests the \emph{formatted call} \product{dyncall} C API.
+Tests the \emph{formatted call/arg} \product{dyncall} C API. Tries to cover all uses of
+that API (e.g. calling convention mode switches, aggregates, ...) but is not extensive.
 
 \item [malloc\_wx]
 Tests \emph{writable and executable memory allocation} used by the
 \product{dyncallback} C API.
 
 \item [thunk]
-Tests \emph{callbacks} for the \product{dyncallback} C API.
+Tests only the \emph{callback} thunks for the \product{dyncallback} C API.
 
 \item [callback\_plain]
 Simple callback function test (useful for easy debugging of new ports).
@@ -117,8 +126,7 @@
 \item [callback\_suite]
 Mass test suite for callback function testing. Uses random function argument
 number and type.
-A script written in Lua generates the tests up to a given number of calls and
-type combinations.
+A Lua script the tests up to a given number of calls and type combinations.
 
 \item [resolv\_self]
 Test for dynload library to resolve symbols from application image itself.
--- a/doc/manual/manual_dyncall_api.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_dyncall_api.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 \section{\emph{Dyncall} C library API}
 
 The library provides low-level functionality to make foreign function calls
@@ -155,17 +155,20 @@
 Constant & Description\\
 \hline
 \lstinline@DC_CALL_C_DEFAULT@            & C default function call for current platform\\
+\lstinline@DC_CALL_C_DEFAULT_THIS@       & C++ default function call for current platform\\
 \lstinline@DC_CALL_C_ELLIPSIS@           & C ellipsis function call (named arguments (before '...'))\\
 \lstinline@DC_CALL_C_ELLIPSIS_VARARGS@   & C ellipsis function call (variable/unnamed arguments (after '...'))\\
 \lstinline@DC_CALL_C_X86_CDECL@          & C x86 platforms standard call\\
 \lstinline@DC_CALL_C_X86_WIN32_STD@      & C x86 Windows standard call\\
 \lstinline@DC_CALL_C_X86_WIN32_FAST_MS@  & C x86 Windows Microsoft fast call\\
 \lstinline@DC_CALL_C_X86_WIN32_FAST_GNU@ & C x86 Windows GCC fast call\\
-\lstinline@DC_CALL_C_X86_WIN32_THIS_MS@  & C x86 Windows Microsoft this call\\
+\lstinline@DC_CALL_C_X86_WIN32_THIS_MS@  & C++ x86 Windows Microsoft thiscall\\
 \lstinline@DC_CALL_C_X86_WIN32_THIS_GNU@ & alias for DC\_CALL\_C\_X86\_CDECL (GNU thiscalls identical to cdecl)\\
 \lstinline@DC_CALL_C_X86_PLAN9@          & C x86 Plan9 call\\
 \lstinline@DC_CALL_C_X64_WIN64@          & C x64 Windows standard call\\
+\lstinline@DC_CALL_C_X64_WIN64_THIS@     & C++ x64 Windows thiscall\\
 \lstinline@DC_CALL_C_X64_SYSV@           & C x64 System V standard call\\
+\lstinline@DC_CALL_C_X64_SYSV_THIS@      & C++ x64 System V thiscall\\
 \lstinline@DC_CALL_C_PPC32_DARWIN@       & C ppc32 Mac OS X standard call\\
 \lstinline@DC_CALL_C_PPC32_OSX@          & alias for DC\_CALL\_C\_PPC32\_DARWIN\\
 \lstinline@DC_CALL_C_PPC32_SYSV@         & C ppc32 SystemV standard call\\
--- a/doc/manual/manual_dyncallback_api.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_dyncallback_api.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -1,99 +1,100 @@
-%//////////////////////////////////////////////////////////////////////////////
-%
-% Copyright (c) 2007,2013 Daniel Adler <dadler@uni-goettingen.de>, 
-%                         Tassilo Philipp <tphilipp@potion-studios.com>
-%
-% Permission to use, copy, modify, and distribute this software for any
-% purpose with or without fee is hereby granted, provided that the above
-% copyright notice and this permission notice appear in all copies.
-%
-% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-%
-%//////////////////////////////////////////////////////////////////////////////
-
-\newpage
-\section{\emph{Dyncallback} C library API}
-
-This library extends \product{dyncall} with function callback support, allowing
-the user to dynamically create a callback object that can be called directly,
-or passed to functions expecting a function-pointer as argument.\\
-\\
-Invoking a \product{dyncallback} calls into a user-defined unified handler that 
-permits iteration and thus dynamic handling over the called-back-function's
-parameters.\\
-\\
-The flexibility is constrained by the set of supported types, though.\\
-\\
-For style conventions and supported types, see \product{dyncall} API section.
-In order to use \product{dyncallback}, include {\tt "dyncall\_callback.h"}.
-
-\subsection{Callback Object}
-
-The \emph{Callback Object} is the core component to this library.
-
-\paragraph{Types}
-
-\begin{lstlisting}[language=c]
-typedef struct DCCallback DCCallback;
-\end{lstlisting}
-
-\paragraph{Details}
-The \emph{Callback Object} is an object that mimics a fully typed function
-call to another function (a generic callback handler, in this case).\\
-\\
-This means, a pointer to this object is passed to a function accepting a pointer
-to a callback function \emph{as the very callback function pointer itself}.
-Or, if called directly, cast a pointer to this object to a function pointer and
-issue a call.
-
-
-\subsection{Allocation}
-
-\paragraph{Functions}
-
-\begin{lstlisting}[language=c]
-DCCallback* dcbNewCallback(const char*        signature,
-                           DCCallbackHandler* funcptr,
-                           void*              userdata);
-void dcbFreeCallback(DCCallback* pcb);
-\end{lstlisting}
-
-\lstinline{dcbNewCallback} creates and initializes a new \emph{Callback} object,
-where \lstinline{signature} is the needed function signature (format is the
-one outlined in the language bindings-section of this manual, see Table \ref{sigchar})
-of the function to mimic, \lstinline{funcptr} is a pointer to a callback handler,
-and \lstinline{userdata} a pointer to custom data that might be useful in the
-handler.
-Use \lstinline{dcbFreeCallback} to destroy the \emph{Callback} object.\\
-\\
-As with \capi{dcNewCallVM}/\capi{dcFree}, this will allocate memory using the
-system allocators or custom overrides.
-
-
-\subsection{Callback handler}
-
-The unified callback handler's declaration used when creating a \capi{DCCallback}
-is:
-
-\begin{lstlisting}
-char cbHandler(DCCallback* cb,
-               DCArgs*     args,
-               DCValue*    result,
-               void*       userdata);
-\end{lstlisting}
-
-\capi{cb} is a pointer to the \capi{DCCallback} object in use, \capi{args} allows
-for dynamic iteration over the called-back-function's arguments (input) and
-\capi{result} is a pointer to a \capi{DCValue} object in order to store the
-callback's return value (output, to be set by handler).\\
-Finally, \capi{userdata} is a pointer to some user defined data that can be
-set when creating the callback object.
-The handler itself returns a signature character (see Table \ref{sigchar}) specifying the
-data type used for \capi{result}.
-
+%//////////////////////////////////////////////////////////////////////////////
+%
+% Copyright (c) 2007,2013 Daniel Adler <dadler@uni-goettingen.de>, 
+%                         Tassilo Philipp <tphilipp@potion-studios.com>
+%
+% Permission to use, copy, modify, and distribute this software for any
+% purpose with or without fee is hereby granted, provided that the above
+% copyright notice and this permission notice appear in all copies.
+%
+% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+%
+%//////////////////////////////////////////////////////////////////////////////
+
+\clearpage
+\section{\emph{Dyncallback} C library API}
+
+This library extends \product{dyncall} with function callback support, allowing
+the user to dynamically create a callback object that can be called directly,
+or passed to functions expecting a function-pointer as argument.\\
+\\
+Invoking a \product{dyncallback} calls into a user-defined unified handler that 
+permits iteration and thus dynamic handling over the called-back-function's
+parameters.\\
+\\
+The flexibility is constrained by the set of supported types, though.\\
+\\
+For style conventions and supported types, see \product{dyncall} API section.
+In order to use \product{dyncallback}, include {\tt "dyncall\_callback.h"}.
+
+\subsection{Callback Object}
+
+The \emph{Callback Object} is the core component to this library.
+
+\paragraph{Types}
+
+\begin{lstlisting}[language=c]
+typedef struct DCCallback DCCallback;
+\end{lstlisting}
+
+\paragraph{Details}
+The \emph{Callback Object} is an object that mimics a fully typed function
+call to another function (a generic callback handler, in this case).\\
+\\
+This means, a pointer to this object is passed to a function accepting a pointer
+to a callback function \emph{as the very callback function pointer itself}.
+Or, if called directly, cast a pointer to this object to a function pointer and
+issue a call.
+
+
+\subsection{Allocation}
+
+\paragraph{Functions}
+
+\begin{lstlisting}[language=c]
+DCCallback* dcbNewCallback(const char*        signature,
+                           DCCallbackHandler* funcptr,
+                           void*              userdata,
+                           DCaggr**           aggrs);
+void dcbFreeCallback(DCCallback* pcb);
+\end{lstlisting}
+
+\lstinline{dcbNewCallback} creates and initializes a new \emph{Callback} object,
+where \lstinline{signature} is the needed function signature (format is the
+one outlined in the language bindings-section of this manual, see Table \ref{sigchar})
+of the function to mimic, \lstinline{funcptr} is a pointer to a callback handler,
+and \lstinline{userdata} a pointer to custom data that might be useful in the
+handler.
+Use \lstinline{dcbFreeCallback} to destroy the \emph{Callback} object.\\
+\\
+As with \capi{dcNewCallVM}/\capi{dcFree}, this will allocate memory using the
+system allocators or custom overrides.
+
+
+\subsection{Callback handler}
+
+The unified callback handler's declaration used when creating a \capi{DCCallback}
+is:
+
+\begin{lstlisting}
+char cbHandler(DCCallback* cb,
+               DCArgs*     args,
+               DCValue*    result,
+               void*       userdata);
+\end{lstlisting}
+
+\capi{cb} is a pointer to the \capi{DCCallback} object in use, \capi{args} allows
+for dynamic iteration over the called-back-function's arguments (input) and
+\capi{result} is a pointer to a \capi{DCValue} object in order to store the
+callback's return value (output, to be set by handler).\\
+Finally, \capi{userdata} is a pointer to some user defined data that can be
+set when creating the callback object.
+The handler itself returns a signature character (see Table \ref{sigchar}) specifying the
+data type used for \capi{result}.
+
--- a/doc/manual/manual_dynload_api.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_dynload_api.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 \section{\product{Dynload} C library API}
 
 The \product{dynload} library encapsulates dynamic loading mechanisms and
--- a/doc/manual/manual_epilog.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_epilog.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 
 \section{Epilog}
 
--- a/doc/manual/manual_literature.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_literature.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 
 % Force a cut for html output, here.
 \ifhtml{\CutAt{likesection}}
--- a/doc/manual/manual_motivation.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_motivation.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 \section{Motivation}
 
 Interoperability between programming languages is a desirable feature 
--- a/doc/manual/manual_overview.tex	Wed Feb 02 18:30:44 2022 +0100
+++ b/doc/manual/manual_overview.tex	Fri Feb 04 23:54:42 2022 +0100
@@ -17,7 +17,7 @@
 %
 %//////////////////////////////////////////////////////////////////////////////
 
-\newpage
+\clearpage
 
 \section{Overview}