Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Nov 2004 09:41:25 +0200
From:      Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
To:        Dan Strick <strick@covad.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Where is the source to the system calls?
Message-ID:  <20041109074125.GB238@pm514-9.comsys.ntu-kpi.kiev.ua>
In-Reply-To: <200411081857.iA8Iv725000576@mist.nodomain>
References:  <200411081857.iA8Iv725000576@mist.nodomain>

next in thread | previous in thread | raw e-mail | index | archive | help
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".



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041109074125.GB238>