Source string Read only

(itstool) path: sect3/programlisting
Context English State
Syscall handling is mostly written in <filename>linux_sysvec.c</filename>, which covers most of the routines pointed out in the <literal>sysentvec</literal> structure. When a <trademark class="registered">Linux</trademark> process running on FreeBSD issues a syscall, the general syscall routine calls linux prepsyscall routine for the <trademark class="registered">Linux</trademark> ABI.
<trademark class="registered">Linux</trademark> prepsyscall
<trademark class="registered">Linux</trademark> passes arguments to syscalls via registers (that is why it is limited to 6 parameters on i386) while FreeBSD uses the stack. The <trademark class="registered">Linux</trademark> prepsyscall routine must copy parameters from registers to the stack. The order of the registers is: <varname>%ebx</varname>, <varname>%ecx</varname>, <varname>%edx</varname>, <varname>%esi</varname>, <varname>%edi</varname>, <varname>%ebp</varname>. The catch is that this is true for only <emphasis>most</emphasis> of the syscalls. Some (most notably <function>clone</function>) uses a different order but it is luckily easy to fix by inserting a dummy parameter in the <function>linux_clone</function> prototype.
Syscall writing
Every syscall implemented in the Linuxulator must have its prototype with various flags in <filename>syscalls.master</filename>. The form of the file is:
AUE_FORK STD { int linux_fork(void); }
AUE_CLOSE NOPROTO { int close(int fd); }
The first column represents the syscall number. The second column is for auditing support. The third column represents the syscall type. It is either <literal>STD</literal>, <literal>OBSOL</literal>, <literal>NOPROTO</literal> and <literal>UNIMPL</literal>. <literal>STD</literal> is a standard syscall with full prototype and implementation. <literal>OBSOL</literal> is obsolete and defines just the prototype. <literal>NOPROTO</literal> means that the syscall is implemented elsewhere so do not prepend ABI prefix, etc. <literal>UNIMPL</literal> means that the syscall will be substituted with the <function>nosys</function> syscall (a syscall just printing out a message about the syscall not being implemented and returning <literal>ENOSYS</literal>).
From <filename>syscalls.master</filename> a script generates three files: <filename>linux_syscall.h</filename>, <filename>linux_proto.h</filename> and <filename>linux_sysent.c</filename>. The <filename>linux_syscall.h</filename> contains definitions of syscall names and their numerical value, e.g.:
#define LINUX_SYS_linux_fork 2
#define LINUX_SYS_close 6
The <filename>linux_proto.h</filename> contains structure definitions of arguments to every syscall, e.g.:
struct linux_fork_args {
register_t dummy;


No matching activity found.

Browse all component changes

Things to check

Long untranslated

The string was not translated for a long time



The string uses three dots (...) instead of an ellipsis character (…)



English English
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect3/programlisting
No labels currently set.
no-wrap, read-only
Source string location
Source string age
9 months ago
Translation file
, string 209