1193323Sed%
2193323Sed% Copyright 2014, General Dynamics C4 Systems
3193323Sed%
4193323Sed% SPDX-License-Identifier: GPL-2.0-only
5193323Sed%
6193323Sed
7193323Sed%macros for API documentation
8193323Sed\newcommand{\param}[3]{\texttt{#1}&\texttt{#2}&#3\\ }
9193323Sed
10193323Sed\newcommand{\inputapidoc}[1] {\input{parts/api/#1.tex}}
11193323Sed\newcommand{\inputgeneratedapidoc}[1] {\input{generated/#1.tex}}
12193323Sed
13193323Sed\newcommand{\apidoc}[8][subsection]
14193323Sed{
15193323Sed    \ifthenelse{\equal{#1}{subsection}}{
16193323Sed        \subsection{\label{api:#2}#3}
17193323Sed    }{}
18193323Sed    \ifthenelse{\equal{#1}{subsubsection}}{
19193323Sed        \subsubsection{\label{api:#2}#3}
20193323Sed    }{}
21193323Sed
22193323Sed    \texttt{#5}
23193323Sed    \vspace*{6pt}
24193323Sed
25193323Sed    #4
26193323Sed
27193323Sed    \begin{center}
28193323Sed    \begin{minipage}{0.95\textwidth}
29193323Sed    \begin{tabularx}{\textwidth}{llX}
30193323Sed    \toprule
31193323Sed    \textbf{Type} & \textbf{Name} & \textbf{Description} \\
32193323Sed    \midrule
33193323Sed    #6
34234353Sdim    \bottomrule
35193323Sed    \end{tabularx}
36224145Sdim    \end{minipage}
37234353Sdim    \end{center}
38234353Sdim
39200581Srdivacky    \textit{Return value:} #7 \par
40193323Sed
41234353Sdim    \textit{Description:} #8 \par
42193323Sed
43218893Sdim    \vfill
44234353Sdim}
45193323Sed
46193323Sed%Common parameter descriptions
47193323Sed
48218893Sdim\newcommand{\debugargbpnumshortdesc}{
49218893SdimThe API-ID of a target breakpoint. This ID will be a positive integer, with
50218893Sdimvalues ranging from \texttt{0} to \texttt{seL4\_NumHWBreakpoints - 1}.
51193323Sed}
52193323Sed
53198090Srdivacky\newcommand{\debugargvaddrshortdesc}{A virtual address which forms part of the
54193323Sedmatch conditions for the triggering of the breakpoint.
55193323Sed}
56193323Sed
57193323Sed\newcommand{\debugargtypeshortdesc}{One of: \texttt{seL4\_InstructionBreakpoint}, which specifies
58193323Sedthat the breakpoint should occur on instruction execution at the specified
59234353Sdim\texttt{vaddr} or \texttt{seL4\_DataBreakpoint}, which states that the breakpoint
60193323Sedshould occur on data access at the specified \texttt{vaddr}.
61193323Sed}
62193323Sed
63193323Sed\newcommand{\debugargsizeshortdesc}{A positive integer indicating the
64193323Sedtrigger-span of the watchpoint. Must be zero when 'type' is \texttt{seL4\_InstructionBreakpoint}.
65204642Srdivacky}
66218893Sdim
67193323Sed\newcommand{\debugargrwshortdesc}{One of \texttt{seL4\_BreakOnRead}, meaning the breakpoint will only be
68198090Srdivackytriggered on read-access; \texttt{seL4\_BreakOnWrite} meaning the
69198090Srdivackybreakpoint will only be triggered on write-access, and
70203954Srdivacky\texttt{seL4\_BreakOnReadWrite} meaning the breakpoint will be triggered on
71203954Srdivackyany access.
72198090Srdivacky}
73234353Sdim
74212904Sdim\ifxeightsix
75234353Sdim\newcommand{\vmattribsdescintel}{VM Attributes for the
76234353Sdim  mapping. Possible values for this type are given in \autoref{ch:vspace}. }
77234353Sdim\fi
78234353Sdim
79212904Sdim\newcommand{\noret}{This method does not return anything.}
80193323Sed\newcommand{\errorenumdesc}{A return value of \texttt{0} indicates success. A non-zero value indicates that an error occurred. See \autoref{sec:errors} for a description of the message register and tag contents upon error.}
81193323Sed\newcommand{\tcbgetbreakpointtdesc}{Struct that contains
82218893Sdim'\texttt{seL4\_Error error}', an seL4 API error value,
83218893Sdim'\texttt{seL4\_Word vaddr}', the virtual address at which the breakpoint will currently
84218893Sdimbe triggered;
85218893Sdim'\texttt{seL4\_Word type}', the type of operation which will currently trigger the
86218893Sdimbreakpoint, whether instruction execution, or data access;
87218893Sdim'\texttt{seL4\_Word size}', integer value for the span-size of the breakpoint.
88193323SedUsually a multiple of two (1, 2, 4, etc.);
89218893Sdim'\texttt{seL4\_Word rw}', the access direction that will currently trigger the breakpoint,
90193323Sedwhether read, write, or both and
91218893Sdim'\texttt{seL4\_Bool is\_enabled}', which indicates whether or not the breakpoint
92224145Sdimwill currently be triggered if the match conditions are met.
93224145Sdim}
94218893Sdim\newcommand{\tcbconfiguresinglesteppingtdesc}{Struct that contains
95218893Sdim'\texttt{seL4\_Error error}', an seL4 API error value,
96218893Sdim'\texttt{seL4\_Bool bp\_was\_consumed}', a boolean which indicates whether or not the \texttt{bp\_num}
97218893Sdimbreakpoint ID that was passed to the function, was consumed in the setup of the single-stepping
98218893Sdimfunctionality: if this is \texttt{true}, the caller should not attempt to re-use \texttt{bp\_num}
99218893Sdimuntil it has disabled the single-stepping functionality via a subsequent call to
100218893SdimseL4\_TCB\_ConfigureSingleStepping with an \texttt{nun\_instructions} argument of 0.
101193323Sed}
102218893Sdim
103218893Sdim\newcommand{\todo}{TODO}
104218893Sdim
105218893Sdim\section{Error Codes}
106193323Sed\label{sec:errors}
107218893Sdim
108218893SdimInvoking a capability with invalid parameters will result in an error.
109193323SedseL4 system calls return an error code in the message tag and a short
110218893Sdimerror description in the message registers to aid the programmer in
111218893Sdimdetermining the cause of errors.\\
112193323Sed
113218893Sdim\subsection{Invalid Argument}
114212904Sdim
115218893SdimA non-capability argument is invalid.
116218893Sdim
117218893Sdim\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
118218893Sdim\toprule
119218893Sdim    Field & Meaning \\
120218893Sdim\midrule
121218893Sdim    \ipcbloc{Label} & \enummem{seL4\_InvalidArgument} \\
122218893Sdim    \ipcbloc{IPCBuffer[0]} & Invalid argument number \\
123212904Sdim\bottomrule
124193323Sed\end{tabularx}
125218893Sdim\vfill
126193323Sed
127224145Sdim\subsection{Invalid Capability}
128224145Sdim
129218893SdimA capability argument is invalid.
130218893Sdim
131218893Sdim\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
132218893Sdim\toprule
133218893Sdim    Field & Meaning \\
134218893Sdim\midrule
135203954Srdivacky    \ipcbloc{Label} & \enummem{seL4\_InvalidCapability} \\
136234353Sdim    \ipcbloc{IPCBuffer[0]} & Invalid capability argument number \\
137218893Sdim\bottomrule
138218893Sdim\end{tabularx}
139218893Sdim\vfill
140193323Sed
141218893Sdim\subsection{Illegal Operation}
142193323Sed
143218893SdimThe requested operation is not permitted.
144218893Sdim
145193323Sed\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
146218893Sdim\toprule
147218893Sdim    Field & Meaning \\
148218893Sdim\midrule
149218893Sdim    \ipcbloc{Label} & \enummem{seL4\_IllegalOperation} \\
150193323Sed\bottomrule
151218893Sdim\end{tabularx}
152218893Sdim\vfill
153218893Sdim
154193323Sed\subsection{Range Error}
155218893Sdim
156193323SedAn argument is out of the allowed range.
157218893Sdim
158193323Sed\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
159218893Sdim\toprule
160193323Sed    Field & Meaning \\
161218893Sdim\midrule
162218893Sdim    \ipcbloc{Label} & \enummem{seL4\_RangeError} \\
163218893Sdim    \ipcbloc{IPCBuffer[0]} & Minimum allowed value \\
164218893Sdim    \ipcbloc{IPCBuffer[1]} & Maximum allowed value \\
165218893Sdim\bottomrule
166193323Sed\end{tabularx}
167218893Sdim\vfill
168218893Sdim
169218893Sdim\subsection{Alignment Error}
170218893Sdim
171234353SdimA supplied argument does not meet the alignment requirements.
172218893Sdim
173193323Sed\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
174218893Sdim\toprule
175218893Sdim    Field & Meaning \\
176218893Sdim\midrule
177218893Sdim    \ipcbloc{Label} & \enummem{seL4\_AlignmentError} \\
178218893Sdim\bottomrule
179218893Sdim\end{tabularx}
180218893Sdim\vfill
181193323Sed
182218893Sdim\subsection{Failed Lookup}
183218893Sdim
184193323SedA capability could not be looked up.
185218893Sdim
186218893Sdim\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
187218893Sdim\toprule
188193323Sed    Field & Meaning \\
189193323Sed\midrule
190218893Sdim    \ipcbloc{Label} & \enummem{seL4\_FailedLookup} \\
191218893Sdim    \ipcbloc{IPCBuffer[0]} & 1 if the lookup failed for a source capability, 0 otherwise\\
192218893Sdim    \ipcbloc{IPCBuffer[1]} & Type of lookup failure\\
193218893Sdim    \ipcbloc{IPCBuffer[2..]} & Lookup failure description as described in \autoref{sec:lookup_fail_desc}\\
194193323Sed\bottomrule
195218893Sdim\end{tabularx}
196239462Sdim\vfill
197218893Sdim
198234353Sdim\subsection{Truncated Message}
199193323Sed
200218893SdimToo few message words or capabilities were sent in the message.
201218893Sdim
202218893Sdim\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
203193323Sed\toprule
204218893Sdim    Field & Meaning \\
205239462Sdim\midrule
206239462Sdim    \ipcbloc{Label} & \enummem{seL4\_TruncatedMessage} \\
207239462Sdim\bottomrule
208239462Sdim\end{tabularx}
209239462Sdim\vfill
210218893Sdim
211193323Sed\subsection{Delete First}
212218893Sdim
213193323SedA destination slot specified in the syscall arguments is occupied.
214234353Sdim
215218893Sdim\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
216218893Sdim\toprule
217218893Sdim    Field & Meaning \\
218218893Sdim\midrule
219239462Sdim    \ipcbloc{Label} & \enummem{seL4\_DeleteFirst} \\
220193323Sed\bottomrule
221239462Sdim\end{tabularx}
222239462Sdim\vfill
223239462Sdim
224239462Sdim\subsection{Revoke First}
225218893Sdim
226218893SdimThe object currently has other objects derived from it and the requested
227218893Sdiminvocation cannot be performed until either these objects are deleted or
228234353Sdimthe revoke invocation is performed on the capability.
229224145Sdim
230224145Sdim\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
231239462Sdim\toprule
232239462Sdim    Field & Meaning \\
233193323Sed\midrule
234239462Sdim    \ipcbloc{Label} & \enummem{seL4\_RevokeFirst} \\
235239462Sdim\bottomrule
236218893Sdim\end{tabularx}
237193323Sed\vfill
238239462Sdim
239239462Sdim\subsection{Not Enough Memory}
240239462Sdim
241239462SdimThe \obj{Untyped Memory} object does not have enough unallocated space to
242239462Sdimcomplete the \apifunc{seL4\_Untyped\_Retype}{untyped_retype} request.
243239462Sdim
244234353Sdim\begin{tabularx}{\textwidth}{p{0.25\textwidth}X}
245218893Sdim\toprule
246239462Sdim    Field & Meaning \\
247239462Sdim\midrule
248193323Sed    \ipcbloc{Label} & \enummem{seL4\_NotEnoughMemory} \\
249239462Sdim    \ipcbloc{IPCBuffer[0]} & Amount of memory available in bytes\\
250239462Sdim\bottomrule
251234353Sdim\end{tabularx}
252234353Sdim\vfill
253218893Sdim
254234353Sdim\section{System Calls}
255218893Sdim
256193323Sed\subsection{General System Calls}
257218893SdimThis section provides the system call API for non-MCS kernel configurations.
258218893Sdim\inputgeneratedapidoc{GeneralSystemCalls}
259193323Sed\clearpage
260218893Sdim\subsection{General System Calls (MCS) }
261218893SdimThis section provides the system call API for MCS kernel configurations.
262193323Sed\inputgeneratedapidoc{MCSSystemCalls}
263218893Sdim\clearpage
264218893Sdim
265193323Sed\subsection{Debugging System Calls}
266218893Sdim\inputgeneratedapidoc{DebuggingSystemCalls}
267218893Sdim\clearpage
268218893Sdim
269218893Sdim\subsection{Benchmarking System Calls}
270218893Sdim\inputgeneratedapidoc{BenchmarkingSystemCalls}
271193323Sed\clearpage
272218893Sdim
273218893Sdim\subsection{X86 System Calls}
274218893Sdim\inputgeneratedapidoc{X86SystemCalls}
275218893Sdim\clearpage
276218893Sdim
277193323Sed\section{Architecture-Independent Object Methods}
278218893Sdim\label{sec:kobj_api}
279218893Sdim\inputgeneratedapidoc{ObjectApi}
280218893Sdim
281218893Sdim\ifxeightsix
282218893Sdim
283218893Sdim\clearpage
284218893Sdim
285193323Sed\section{x86-Specific Object Methods}
286193323Sed\inputgeneratedapidoc{ObjectApiX86}
287193323Sed\clearpage
288193323Sed
289218893Sdim\section{IA32-Specific Object Methods}
290218893Sdim\inputgeneratedapidoc{ObjectApiIa32}
291193323Sed\clearpage
292218893Sdim
293218893Sdim\section{x86\_64-Specific Object Methods}
294218893Sdim\inputgeneratedapidoc{ObjectApiX64}
295193323Sed
296193323Sed\fi
297218893Sdim
298218893Sdim\clearpage
299218893Sdim
300218893Sdim\section{ARM-Specific Object Methods}
301218893Sdim
302218893Sdim\inputgeneratedapidoc{ObjectApiArm}
303218893Sdim\clearpage
304193323Sed
305218893Sdim\section{Aarch32-Specific Object Methods}
306218893Sdim\inputgeneratedapidoc{ObjectApiAarch32}
307193323Sed\clearpage
308218893Sdim
309218893Sdim\section{Aarch64-Specific Object Methods}
310193323Sed\inputgeneratedapidoc{ObjectApiAarch64}
311218893Sdim\clearpage
312218893Sdim
313193323Sed\section{RISCV-Specific Object Methods}
314193323Sed\subsection{General RISCV Object Methods}
315193323Sed\inputgeneratedapidoc{ObjectApiRISCV}
316193323Sed