next up previous
Next: About this document ... Up: Adding a System Call Previous: Implementation code

Creating a stub for your system call

Listing 3 shows a program which uses the _syscall macro to create a stub for the system call. It then proceeds to call the stub function. When compiling, be sure to specify the -I option so that gcc will look at the modified version of unistd.h. In the example, the preprocessor looks for the file in asm/arch/unistd.h, so if the UML code is in directory /uml-code you should compile with -I/uml-code.


\begin{lstlisting}[frame=tb,indent=20pt,caption={
testprog.c}]
/* testprog.c */
...
...argc, char *argv[]) {
printf(''calling...\n'');
somename();
}
\end{lstlisting}



Alexandros Karypidis 2002-03-25