# HG changeset patch # User Tassilo Philipp # Date 1578174531 -3600 # Node ID 6e33db95e724ea620eee4c8909b70145afc31d98 # Parent 4f9f49fb82ce7e38841dfa003e42ab4e77fbc4c1 - syscall infos in doc diff -r 4f9f49fb82ce -r 6e33db95e724 doc/manual/callconvs/callconv_x64.tex --- a/doc/manual/callconvs/callconv_x64.tex Sat Jan 04 01:07:49 2020 +0100 +++ b/doc/manual/callconvs/callconv_x64.tex Sat Jan 04 22:48:51 2020 +0100 @@ -46,10 +46,9 @@ \paragraph{\product{dyncall} support} -\product{dyncall} supports the MS Windows and System V calling convention.\\ -\\ - - +Currently, the MS Windows and System V calling conventions are supported.\\ +\product{Dyncall} can also be used to issue syscalls on System V platforms by +using the syscall number as target parameter and selecting the correct mode. \subsubsection{MS Windows} @@ -241,3 +240,19 @@ \caption{Stack layout on x64 System V (Linux/*BSD)} \end{figure} + +\newpage + +\subsubsection{System V syscalls} + +\paragraph{Parameter passing} + +\begin{itemize} +\item syscall is issued via the {\em syscall} instruction +\item kernel destroys registers rcx and r11 +\item syscall number is set in rax +\item up to 6 params are passed in the following registers in this order: rdi, rsi, rdx, rcx, r8, r9 +\item no stack in use, meaning syscalls are limited to six arguments +\item register rax holds the return value (values in between -4095 and -1 indicate errors) +\end{itemize} + diff -r 4f9f49fb82ce -r 6e33db95e724 doc/manual/callconvs/callconv_x86.tex --- a/doc/manual/callconvs/callconv_x86.tex Sat Jan 04 01:07:49 2020 +0100 +++ b/doc/manual/callconvs/callconv_x86.tex Sat Jan 04 22:48:51 2020 +0100 @@ -60,7 +60,8 @@ Currently cdecl, stdcall, fastcall (MS and GNU), thiscall (MS and GNU) and plan9call are supported.\\ -\\ +\product{Dyncall} can also be used to issue syscalls on Linux and *BSD by using +the syscall number as target parameter and selecting the correct mode. \newpage @@ -806,3 +807,22 @@ \caption{Stack layout on x86 plan9call calling convention} \end{figure} + +%@@@ \newpage +%@@@ +%@@@ \subsubsection{Linux syscalls} +%@@@ +%@@@ \paragraph{Parameter passing} +%@@@ +%@@@ \begin{itemize} +%@@@ \item ... +%@@@ \end{itemize} +%@@@ +%@@@ \subsubsection{*BSD syscalls} +%@@@ +%@@@ \paragraph{Parameter passing} +%@@@ +%@@@ \begin{itemize} +%@@@ \item ... +%@@@ \end{itemize} + diff -r 4f9f49fb82ce -r 6e33db95e724 doc/manual/manual_dyncall_api.tex --- a/doc/manual/manual_dyncall_api.tex Sat Jan 04 01:07:49 2020 +0100 +++ b/doc/manual/manual_dyncall_api.tex Sat Jan 04 22:48:51 2020 +0100 @@ -188,6 +188,7 @@ \lstinline@DC_CALL_SYS_DEFAULT@ & C default syscall for current platform\\ \lstinline@DC_CALL_SYS_X86_INT80H_BSD@ & C syscall for x86 BSD platforms\\ \lstinline@DC_CALL_SYS_X86_INT80H_LINUX@ & C syscall for x86 Linux\\ +\lstinline@DC_CALL_SYS_X64_SYSCALL_SYSV@ & C syscall for x64 System V platforms\\ \lstinline@DC_CALL_SYS_PPC32@ & C syscall for ppc32\\ \lstinline@DC_CALL_SYS_PPC64@ & C syscall for ppc64\\ \end{tabular*}