changeset 340:6e33db95e724

- syscall infos in doc
author Tassilo Philipp
date Sat, 04 Jan 2020 22:48:51 +0100
parents 4f9f49fb82ce
children ab2d78e48ca2
files doc/manual/callconvs/callconv_x64.tex doc/manual/callconvs/callconv_x86.tex doc/manual/manual_dyncall_api.tex
diffstat 3 files changed, 41 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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}
+
--- 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}
+
--- 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*}