Where is the source to the system calls?

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Mon Nov 8 23:42:03 PST 2004


On Mon, Nov 08, 2004 at 10:57:07AM -0800, Dan Strick wrote:
> 
> Perhaps I did not make it clear that I was looking for the definitions
> of the subroutines in libc that converted C-language function calls,
> such as open(), into assembler language system calls.  For example, in
> version 7 pdp11 unix, the open() system call was defined in the very
> straight forward assembler language program /usr/src/libc/sys/open.s:

[ skipped ]

Almost the same is done in FreeBSD, but under i386 int $0x80 is a trap gate
for system calls (search int0x80_syscall in /sys/i386/i386/exception.s).

If that SYS.h is unclear for you for the first time, so read paragraphs
about x86 Assembler and syscalls in Developers' Handbook.

> I still don't understand all the details but I do understand enough
> to realize that I don't want to understand any more.

Assembler sources for syscalls are created from the src/lib/libc/sys/
Makefile.inc file.  Find #include "SYS.h" in this file.  The names
of syscalls are generated from the /sys/sys/syscall.mk, which is
generated from sys/kern/syscalls.master.  Try to discover how this
works backtracing Makefile.inc from the line with #include "SYS.h".


More information about the freebsd-hackers mailing list