overhaul syscall interface

this commit shuffles around the location of syscall definitions so
that we can make a syscall() library function with both SYS_* and
__NR_* style syscall names available to user applications, provides
the syscall() library function, and optimizes the code that performs
the actual inline syscalls in the library itself.

previously on i386 when built as PIC (shared library), syscalls were
incurring bus lock (lock prefix) overhead at entry and exit, due to
the way the ebx register was being loaded (xchg instruction with a
memory operand). now the xchg takes place between two registers.

further cleanup to arch/$(ARCH)/syscall.h is planned.
This commit is contained in:
Rich Felker
2011-03-19 18:51:42 -04:00
parent 56fd65e861
commit d00ff2950e
11 changed files with 1582 additions and 754 deletions

View File

@ -0,0 +1,11 @@
#include <errno.h>
#include <unistd.h>
long __syscall_ret(unsigned long r)
{
if (r >= (unsigned long)-1 - 4096) {
errno = -(long)r;
return -1;
}
return (long)r;
}