Re: Differences between FreeBSD and Linux system call mechanism

Matthias Urlichs (smurf@noris.de)
8 Sep 1998 14:15:51 +0200


Alexander Kjeldaas <astor@guardian.no> writes:
> On Thu, Sep 03, 1998 at 04:58:02PM +0200, Joerg Pommnitz wrote:
> >
> > I don't have hard numbers, but it looks much slower to me,
> > even if the new kernel entry instruction is a few cycles faster
> > than int 0x80.
> >
> > If something like this is implemented at all, it should
> > be done in libc. glibc already has mechanisms in place to select
> > CPU type optimized code at run time. It would probably be easy to
> > use the same thing for system calls.
>
> I can see how glibc can do it slower, but not faster. An
> unconditional branch is (almost) free on modern CPUs, using only extra
> issue logic. I'm quite certain that using sysenter will be profitable
> even if it means going through an extra branch.

Glibc would NOT need an extra branch. It would simply load the library with
PII-specific syscalls before opening libc.so, which would cause all calls
to, say, __read(), to automagically execute the specific syscall instead of
the generic one.

In fact, glibc-2.1's /lib/ld-linux.so.2 already tries to do this.

> Jumping to kernel-specific thunking-code is the way glibc will have to
> implement this too. However, glibc doesn't know what kernel version
> is available unless it does a system call (or we could map a page with
> the version-number that it could read, but then we could just as well
> map the thunking-code directly).
>
The easy solution to this is to simply not install the specific library in
the first place.

I don't know offhand if the initialization code of the library is able to
check whether it can run, and then return "oops, take me out again" to the
loader.

-- 
Matthias Urlichs      |        noris network GmbH      |       smurf@noris.de
The quote was selected randomly. Really.    |      http://www.noris.de/~smurf/
-- 
Democrats name their children after currently popular sports figures,
politicians, and entertainers.  Republican children are named after
their parents or grandparents, depending on where the money is.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/faq.html