summaryrefslogtreecommitdiff
path: root/libc/gnu_i386
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1997-10-05 15:05:09 +0200
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:40:02 +0200
commit48798bf2eb93ec3b99720ac2e16093441156653d (patch)
tree35e03d95df5f2677f05e32d70abb6d0583aa47ba /libc/gnu_i386
parent9d97bc3cb3aecd3416fb7c4be3ca2f436665b696 (diff)
downloaddev86-48798bf2eb93ec3b99720ac2e16093441156653d.tar.gz
Import Dev86src-0.13.0.tar.gzv0.13.0
Diffstat (limited to 'libc/gnu_i386')
-rw-r--r--libc/gnu_i386/Config1
-rw-r--r--libc/gnu_i386/Makefile59
-rw-r--r--libc/gnu_i386/cstartup.s85
-rw-r--r--libc/gnu_i386/dirent.c106
-rw-r--r--libc/gnu_i386/exec.c292
-rw-r--r--libc/gnu_i386/heap.c76
-rw-r--r--libc/gnu_i386/mksyscall123
-rw-r--r--libc/gnu_i386/syscall.dat155
-rw-r--r--libc/gnu_i386/syscall.s2969
9 files changed, 3866 insertions, 0 deletions
diff --git a/libc/gnu_i386/Config b/libc/gnu_i386/Config
new file mode 100644
index 0000000..6b218f4
--- /dev/null
+++ b/libc/gnu_i386/Config
@@ -0,0 +1 @@
+gnu386: Linux-i386 system call routines GCC
diff --git a/libc/gnu_i386/Makefile b/libc/gnu_i386/Makefile
new file mode 100644
index 0000000..5ec95b2
--- /dev/null
+++ b/libc/gnu_i386/Makefile
@@ -0,0 +1,59 @@
+# Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
+# This file is part of the Linux-8086 C library and is distributed
+# under the GNU Library General Public License.
+
+CSRC=cstartup.s
+COBJ=cstartup.o
+
+ESRC=exec.c
+EOBJ=execl.o execv.o execle.o execlp.o execvp.o
+
+DSRC=dirent.c
+DOBJ=opendir.o closedir.o readdir.o
+
+HSRC=heap.c
+HOBJ=__brk_addr.o brk.o sbrk.o
+
+ifeq ($(LIB_CPU)-$(LIB_OS),g386-ELKS)
+OBJ=$(COBJ) $(EOBJ) $(DOBJ) $(HOBJ)
+SYSCALLS=syscalls
+
+CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS)
+
+all: $(SYSCALLS) $(LIBC)($(OBJ))
+ @$(RM) $(OBJ)
+
+syscalls: syscall.mak
+ $(MAKE) -f syscall.mak LIBC="$(LIBC)" CFLAGS="$(CFLAGS)"
+
+syscall.mak: mksyscall syscall.dat
+ sh mksyscall
+
+$(LIBC)($(LOBJ)): $(LSRC)
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
+ $(AR) $(ARFLAGS) $@ $*.o
+
+$(LIBC)($(COBJ)): $(CSRC)
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
+ $(AR) $(ARFLAGS) $@ $*.o
+
+$(LIBC)($(DOBJ)): $(DSRC)
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
+ $(AR) $(ARFLAGS) $@ $*.o
+
+$(LIBC)($(EOBJ)): $(ESRC)
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
+ $(AR) $(ARFLAGS) $@ $*.o
+
+$(LIBC)($(HOBJ)): $(HSRC)
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
+ $(AR) $(ARFLAGS) $@ $*.o
+else
+all:
+ @:
+endif
+
+clean:
+ rm -f *.o libc.a
+ rm -f syscall.c syscall.mak
+
diff --git a/libc/gnu_i386/cstartup.s b/libc/gnu_i386/cstartup.s
new file mode 100644
index 0000000..780d3a4
--- /dev/null
+++ b/libc/gnu_i386/cstartup.s
@@ -0,0 +1,85 @@
+#
+# This is a startup for GCC compiling to an ELF executable.
+#
+#
+ .file "cstartup.s"
+
+# void (*__cleanup)() = 0;
+
+.globl __cleanup
+.data
+ .align 4
+ .type __cleanup,@object
+ .size __cleanup,4
+__cleanup:
+ .long 0
+
+.globl errno
+ .align 4
+ .type errno,@object
+ .size errno,4
+errno:
+ .long 0
+
+# char ** environ;
+ .comm environ,4,4
+
+.text
+ .align 16
+.globl __cstartup
+.type __cstartup,@function
+__cstartup: # Crt0 startup (Linux style)
+ cmpl $0,(%esp)
+ jz call_exit # If argc == 0 this is being called by ldd, exit.
+
+ popl %ecx
+ movl %esp,%ebx # Points to the arguments
+ movl %esp,%eax
+ movl %ecx,%edx
+ addl %edx,%edx
+ addl %edx,%edx
+ addl %edx,%eax
+ addl $4,%eax # Now points to environ.
+
+ pushl %eax # envp
+ pushl %ebx # argp
+ pushl %ecx # argc
+
+ # mov 8(%esp),%eax
+ mov %eax,environ
+
+ call main
+ push %eax # Main has returned,
+call_exit:
+ call exit # return val and call exit();
+bad_exit:
+ jmp bad_exit # Exit returned !!
+
+# Exit - call __cleanup then _exit
+
+ .align 16
+.globl exit
+ .type exit,@function
+exit:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ movl 8(%ebp),%ebx
+ movl __cleanup,%eax
+ testl %eax,%eax
+ je .L8
+ pushl %ebx
+ call *%eax
+ addl $4,%esp
+.L8:
+ pushl %ebx
+ call _exit
+ jmp bad_exit
+
+# _exit is an alias for __exit
+ .align 16
+.globl _exit
+ .type _exit,@function
+_exit:
+ jmp __exit
+
diff --git a/libc/gnu_i386/dirent.c b/libc/gnu_i386/dirent.c
new file mode 100644
index 0000000..8f7574c
--- /dev/null
+++ b/libc/gnu_i386/dirent.c
@@ -0,0 +1,106 @@
+
+#include <errno.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <malloc.h>
+
+#ifdef L_opendir
+DIR *
+opendir(dname)
+const char *dname;
+{
+ struct stat st;
+ int fd;
+ DIR *p;
+
+ if (stat(dname, &st) < 0)
+ return 0;
+
+ if (!S_ISDIR(st.st_mode))
+ {
+ errno = ENOTDIR;
+ return 0;
+ }
+ if ((fd = open(dname, O_RDONLY)) < 0)
+ return 0;
+
+ p = malloc(sizeof(DIR));
+ if (p == 0)
+ {
+ close(fd);
+ return 0;
+ }
+
+ p->dd_buf = malloc(sizeof(struct dirent));
+ if (p->dd_buf == 0)
+ {
+ free(p);
+ close(fd);
+ return 0;
+ }
+ p->dd_fd = fd;
+ p->dd_loc = p->dd_size = 0;
+
+ return p;
+}
+#endif
+
+#ifdef L_closedir
+int
+closedir(dirp)
+DIR *dirp;
+{
+ int fd;
+ fd = dirp->dd_fd;
+ free(dirp->dd_buf);
+ free(dirp);
+ return close(fd);
+}
+#endif
+
+#ifdef __AS386_16__
+#ifdef L_readdir
+/*
+ * This currently assumes we see a v. simple diectory structure, it's
+ * probably faked!
+ */
+struct dirent *
+readdir(dirp)
+DIR *dirp;
+{
+ int cc;
+ cc = read(dirp->dd_fd, dirp->dd_buf, sizeof(struct dirent));
+
+ if (cc <= 0)
+ return 0;
+ if (cc != sizeof(struct dirent))
+ {
+ errno = EBADF;
+ return 0;
+ }
+ return dirp->dd_buf;
+}
+#endif
+#else
+
+/* This is for 386 linux */
+
+#ifdef L_readdir
+struct dirent *
+readdir(dirp)
+DIR *dirp;
+{
+ int cc;
+
+ cc = __readdir(dirp->dd_fd, dirp->dd_buf, 1);
+ if (cc <= 0)
+ return 0;
+ if (cc>1) dirp->dd_buf->d_name[cc] = 0;
+
+ return dirp->dd_buf;
+}
+#endif
+
+#endif
diff --git a/libc/gnu_i386/exec.c b/libc/gnu_i386/exec.c
new file mode 100644
index 0000000..411b744
--- /dev/null
+++ b/libc/gnu_i386/exec.c
@@ -0,0 +1,292 @@
+
+#include <errno.h>
+#include <sys/stat.h>
+
+extern char ** environ;
+
+#ifdef L_execl
+int
+execl(fname, arg0)
+char * fname, *arg0;
+{
+ return execve(fname, &arg0, environ);
+}
+#endif
+
+#ifdef L_execv
+int
+execv(fname, argv)
+char * fname, **argv;
+{
+ return execve(fname, argv, environ);
+}
+#endif
+
+#ifdef L_execle
+int
+execle(fname, arg0)
+char *fname, *arg0;
+{
+ char ** envp = &arg0;
+ while(*envp) envp++;
+ return execve(fname, &arg0, envp+1);
+}
+#endif
+
+#ifdef L_execve
+int
+execve(fname, argv, envp)
+char * fname;
+char ** argv;
+char ** envp;
+{
+ char **p;
+ int argv_len=0, argv_count=0;
+ int envp_len=0, envp_count=0;
+ int stack_bytes;
+ unsigned short * pip;
+ char * pcp, * stk_ptr, *baseoff;
+ int rv;
+
+ /* How much space for argv */
+ for(p=argv; p && *p && argv_len >= 0; p++)
+ {
+ argv_count++; argv_len += strlen(*p)+1;
+ }
+
+ /* How much space for envp */
+ for(p=envp; p && *p && envp_len >= 0; p++)
+ {
+ envp_count++; envp_len += strlen(*p)+1;
+ }
+
+ /* tot it all up */
+ stack_bytes = 2 /* argc */
+ + argv_count * 2 + 2 /* argv */
+ + argv_len
+ + envp_count * 2 + 2 /* envp */
+ + envp_len;
+
+ /* Allocate it */
+ if( argv_len < 0 || envp_len < 0 || stack_bytes <= 0
+ || (int)(stk_ptr = (char*)sbrk(stack_bytes)) == -1)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+
+/* Sanity check
+ printf("Argv = (%d,%d), Envp=(%d,%d), stack=%d\n",
+ argv_count, argv_len, envp_count, envp_len, stack_bytes);
+*/
+
+ /* Now copy in the strings */
+ pip=(unsigned short *) stk_ptr;
+ pcp=stk_ptr+2*(1+argv_count+1+envp_count+1);
+
+ /* baseoff = stk_ptr + stack_bytes; */
+ baseoff = stk_ptr;
+ *pip++ = argv_count;
+ for(p=argv; p && *p; p++)
+ {
+ int l;
+ *pip++ = pcp-baseoff;
+ l = strlen(*p)+1;
+ memcpy(pcp, *p, l);
+ pcp += l;
+ }
+ *pip++ = 0;
+
+ for(p=envp; p && *p; p++)
+ {
+ int l;
+ *pip++ = pcp-baseoff;
+ l = strlen(*p)+1;
+ memcpy(pcp, *p, l);
+ pcp += l;
+ }
+ *pip++ = 0;
+
+ rv = __exec(fname, stk_ptr, stack_bytes);
+ /* FIXME: This will probably have to interpret '#!' style exe's */
+ sbrk(-stack_bytes);
+ return rv;
+}
+#endif
+
+#ifdef L_execlp
+int
+execlp(fname, arg0)
+char * fname, *arg0;
+{
+ return execvp(fname, &arg0);
+}
+#endif
+
+#ifdef L_execvp
+int
+execvp(fname, argv)
+char * fname, **argv;
+{
+ char *pname = fname, *path;
+ int besterr = ENOENT;
+ int flen, plen;
+ char * bp = sbrk(0);
+
+ if( *fname != '/' && (path = getenv("PATH")) != 0 )
+ {
+ flen = strlen(fname)+2;
+
+ for(;path;)
+ {
+ if( *path == ':' || *path == '\0' )
+ {
+ tryrun(fname, argv);
+ if( errno == EACCES ) besterr = EACCES;
+ if( *path ) path++; else break;
+ }
+ else
+ {
+ char * p = strchr(path, ':');
+ if(p) *p = '\0';
+ plen = strlen(path);
+ pname = sbrk(plen+flen);
+
+ strcpy(pname, path);
+ strcat(pname, "/");
+ strcat(pname, fname);
+
+ tryrun(pname, argv);
+ if( errno == EACCES ) besterr = EACCES;
+
+ brk(pname);
+ pname = fname;
+ if(p) *p++ = ':';
+ path=p;
+ }
+ }
+ }
+
+ tryrun(pname, argv);
+ brk(bp);
+ if( errno == ENOENT || errno == 0 ) errno = besterr;
+ return -1;
+}
+
+static int tryrun(pname, argv)
+char * pname;
+char ** argv;
+{
+static char *shprog[] = {"/bin/sh", "", 0};
+ struct stat st;
+
+ if( stat(pname, &st) < 0 ) return;
+ if( !S_ISREG(st.st_mode) ) return;
+
+#ifdef __AS386_16__
+ __execvve(pname, (void*)0, argv, environ);
+ if( errno == ENOEXEC )
+ {
+ shprog[1] = pname;
+ __execvve(shprog[0], shprog, argv, environ);
+ }
+#else
+ execve(pname, argv, environ);
+ /* FIXME - running /bin/sh in 386 mode */
+#endif
+}
+
+#ifdef __AS386_16__
+static int
+__execvve(fname, interp, argv, envp)
+char * fname;
+char ** interp;
+char ** argv;
+char ** envp;
+{
+ char **p;
+ int argv_len=0, argv_count=0;
+ int envp_len=0, envp_count=0;
+ int stack_bytes;
+ unsigned short * pip;
+ char * pcp, * stk_ptr, *baseoff;
+ int rv;
+
+ /* How much space for argv */
+ for(p=interp; p && *p && argv_len >= 0; p++)
+ {
+ argv_count++; argv_len += strlen(*p)+1;
+ }
+ for(p=argv; p && *p && argv_len >= 0; p++)
+ {
+ argv_count++; argv_len += strlen(*p)+1;
+ }
+
+ /* How much space for envp */
+ for(p=envp; p && *p && envp_len >= 0; p++)
+ {
+ envp_count++; envp_len += strlen(*p)+1;
+ }
+
+ /* tot it all up */
+ stack_bytes = 2 /* argc */
+ + argv_count * 2 + 2 /* argv */
+ + argv_len
+ + envp_count * 2 + 2 /* envp */
+ + envp_len;
+
+ /* Allocate it */
+ if( argv_len < 0 || envp_len < 0 || stack_bytes <= 0
+ || (int)(stk_ptr = (char*)sbrk(stack_bytes)) == -1)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+
+/* Sanity check
+ printf("Argv = (%d,%d), Envp=(%d,%d), stack=%d\n",
+ argv_count, argv_len, envp_count, envp_len, stack_bytes);
+*/
+
+ /* Now copy in the strings */
+ pip=(unsigned short *) stk_ptr;
+ pcp=stk_ptr+2*(1+argv_count+1+envp_count+1);
+
+ /* baseoff = stk_ptr + stack_bytes; */
+ baseoff = stk_ptr;
+ *pip++ = argv_count;
+ for(p=interp; p && *p; p++)
+ {
+ int l;
+ *pip++ = pcp-baseoff;
+ l = strlen(*p)+1;
+ memcpy(pcp, *p, l);
+ pcp += l;
+ }
+ for(p=argv; p && *p; p++)
+ {
+ int l;
+ *pip++ = pcp-baseoff;
+ l = strlen(*p)+1;
+ memcpy(pcp, *p, l);
+ pcp += l;
+ }
+ *pip++ = 0;
+
+ for(p=envp; p && *p; p++)
+ {
+ int l;
+ *pip++ = pcp-baseoff;
+ l = strlen(*p)+1;
+ memcpy(pcp, *p, l);
+ pcp += l;
+ }
+ *pip++ = 0;
+
+ rv = __exec(fname, stk_ptr, stack_bytes);
+ /* FIXME: This will probably have to interpret '#!' style exe's */
+ sbrk(-stack_bytes);
+ return rv;
+}
+#endif
+#endif
diff --git a/libc/gnu_i386/heap.c b/libc/gnu_i386/heap.c
new file mode 100644
index 0000000..bad7e25
--- /dev/null
+++ b/libc/gnu_i386/heap.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 1995-1997 Robert de Bath <rdebath@cix.compulink.co.uk>
+ * This file is part of the Linux-8086 C library and is distributed
+ * under the GNU Library General Public License.
+ */
+
+#include <errno.h>
+
+/****************************************************************************/
+
+#if defined(__GNUC__) && defined(__i386__)
+extern char * __brk_addr;
+extern char * __brk();
+
+#ifdef L___brk_addr
+char * __brk_addr = 0; /* This holds the current return for sbrk(0) */
+
+ /* "mov %ebx,4(%esp),%ebx\n\t" "mov $45,%eax\n\t" */
+
+char *
+__brk(char * val)
+{
+ char * retval;
+ __asm__(
+ "int $0x80"
+ : "=a" (retval)
+ : "0" (45), "b" (val)
+ );
+ return retval;
+}
+
+__brk_addr_init()
+{
+ if( __brk_addr == 0 && (__brk_addr = __brk(0)) == 0 )
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+ return 0;
+}
+#endif
+
+#ifdef L_sbrk
+char *
+sbrk(brk_off)
+int brk_off;
+{
+ char * new_brk;
+ if( __brk_addr_init() ) return (char*)-1;
+ if( brk_off == 0 ) return __brk_addr;
+
+ new_brk = __brk_addr + brk_off;
+ __brk_addr = __brk(new_brk);
+ if( __brk_addr != new_brk )
+ {
+ errno = ENOMEM;
+ return (char*)-1;
+ }
+ return __brk_addr - brk_off;
+}
+#endif
+
+#ifdef L_brk
+int
+brk(new_brk)
+char * new_brk;
+{
+ if( __brk_addr_init() ) return -1;
+
+ __brk_addr = __brk(new_brk);
+ if( __brk_addr == new_brk ) return 0;
+ errno = ENOMEM;
+ return -1;
+}
+#endif
+
+#endif
diff --git a/libc/gnu_i386/mksyscall b/libc/gnu_i386/mksyscall
new file mode 100644
index 0000000..b655e9e
--- /dev/null
+++ b/libc/gnu_i386/mksyscall
@@ -0,0 +1,123 @@
+# Copyright (C) 1995-1997 Robert de Bath <rdebath@cix.compulink.co.uk>
+# This file is part of the Linux-8086 C library and is distributed
+# under the GNU Library General Public License.
+#
+# This script generates the 'simple' system calls for the 386
+#
+# Each call is put into it's own object file, if the semantics of the
+# call are not correct UNIX then the 4th field in the dat file has a
+# marker and the function is generated with a __ prefix.
+#
+#
+# Different levels of squeeze
+# 0 = each is complete
+# 1 = Short codes calling common function
+
+rm -f syscall.c syscall.mak
+
+tr '[A-Z]' '[a-z]' < syscall.dat | \
+awk 'BEGIN{
+ print "# Copyright (C) 1995-1997 Robert de Bath <rdebath@cix.compulink.co.uk>" > "syscall.mak";
+ print "# This file is part of the Linux-8086 C library and is distributed" > "syscall.mak";
+ print "# under the GNU Library General Public License." > "syscall.mak";
+ print "# " > "syscall.mak";
+ print "# This file is automatically generated\n" > "syscall.mak"
+
+ print "# Copyright (C) 1995-1997 Robert de Bath <rdebath@cix.compulink.co.uk>";
+ print "# This file is part of the Linux-8086 C library and is distributed";
+ print "# under the GNU Library General Public License.";
+ print "# ";
+ print "# This file is automatically generated */\n"
+ obj="OBJ=";
+
+ print "# Standard start\n\n"
+ printf("#ifndef __MSDOS__\n");
+ printf("#ifdef __AS386_32__\n");
+ printf(" .text\n");
+ printf(" .align 16\n");
+
+ COMPACT=0;
+}
+/^[ ]*#/ { next; }
+/^[ ]*$/ { next; }
+{
+ if( $2 > max_call ) max_call = $2;
+
+ if( $3 == "x" || $3 == "" ) next;
+ else if( $4 == "-" ) next;
+ else if( $4 == "*" ) funcname="__" $1;
+ else funcname=$1;
+
+ if( length(obj) > 60 )
+ {
+ printf("%s\t\\\n", obj) > "syscall.mak";
+ obj=" ";
+ }
+ obj=obj funcname ".o ";
+
+ printf "# CALL %s\n\n", $0;
+
+ printf(".ifdef L_%s\n", funcname);
+ printf(".globl %s\n", funcname);
+ printf(".type %s,@function\n", funcname);
+ printf("%s:\n", funcname);
+
+ # Inline assembler max to 5 args (20 bytes)
+ if( $3 != 4 && $3 != 5 && ( COMPACT || $3 > 5 ))
+ {
+ printf(" mov %%eax,#%d\n", $2);
+ printf(" br sys_call%d\n", $3);
+ }
+ else
+ {
+ printf(" pushl %%ebp\n");
+ printf(" movl %%esp,%%ebp\n");
+ printf(" pushl %%ebx\n");
+ if( $3 >= 1 ) printf(" mov 8(%%ebp),%%ebx\n");
+ if( $3 >= 2 ) printf(" mov 12(%%ebp),%%ecx\n");
+ if( $3 >= 3 ) printf(" mov 16(%%ebp),%%edx\n");
+ if( $3 >= 4 ) printf(" push %%esi\n");
+ if( $3 >= 4 ) printf(" mov 20(%%ebp),%%esi\n");
+ if( $3 >= 5 ) printf(" push %%edi\n");
+ if( $3 >= 5 ) printf(" mov 24(%%ebp),%%edi\n");
+ printf(" mov $%d,%%eax\n", $2);
+ printf(" int $0x80\n");
+
+ if( $3 >= 5 ) printf(" pop %%edi\n");
+ if( $3 >= 4 ) printf(" pop %%esi\n");
+ printf(" pop %%ebx\n");
+
+ printf(" test %%eax,%%eax\n");
+ printf(" jge syscall_ok\n");
+ printf(" neg %%eax\n");
+ printf(" mov %%eax,errno\n");
+ printf(" mov $-1,%%eax\n");
+ printf("syscall_ok:\n");
+ printf(" movl %%ebp,%%esp\n");
+ printf(" popl %%ebp\n");
+ printf(" ret\n");
+ }
+ printf(".endif\n\n");
+}
+END{
+
+ printf("#endif /* __AS386_32__ */\n\n");
+ printf("#endif /* __MSDOS__ */\n\n");
+ printf("%s\n", obj) > "syscall.mak";
+ printf "\n" > "syscall.mak";
+
+}' > syscall.s
+
+cat >> syscall.mak <<\!
+
+CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS)
+
+all: $(LIBC)($(OBJ))
+ @$(RM) $(OBJ)
+
+$(LIBC)($(OBJ)): syscall.dat mksyscall
+ $(AS) --defsym L_$*=0 syscall.s -o $*.o
+ $(AR) $(ARFLAGS) $@ $*.o
+!
+
+exit $?
diff --git a/libc/gnu_i386/syscall.dat b/libc/gnu_i386/syscall.dat
new file mode 100644
index 0000000..da9ad6c
--- /dev/null
+++ b/libc/gnu_i386/syscall.dat
@@ -0,0 +1,155 @@
+
+#
+# Name No Args Flag, comment
+#
+# . = Ok, with comment
+# * = Needs libc code (Prefix __)
+# - = Obsolete/not required
+#
+# Name N C
+setup 0 X
+exit 1 1 *
+fork 2 0
+vfork 2 0 . Fake alias of fork
+read 3 3
+write 4 3
+open 5 3
+close 6 1
+waitpid 7 3
+creat 8 2
+link 9 2
+unlink 10 1
+execve 11 3
+chdir 12 1
+time 13 1
+dv32_mknod 14 3 * Has correct args for 32bit dev_t
+chmod 15 2
+chown 16 3
+break 17 X - This is done in a special function
+oldstat 18 X -
+lseek 19 3
+getpid 20 0
+mount 21 5
+umount 22 1
+setuid 23 1
+getuid 24 0
+stime 25 1
+ptrace 26 4
+alarm 27 1
+oldfstat 28 X -
+pause 29 0
+utime 30 2
+stty 31 X -
+gtty 32 X -
+access 33 2
+nice 34 1
+ftime 35 1
+sync 36 0
+kill 37 2
+rename 38 2
+mkdir 39 2
+rmdir 40 1
+dup 41 1
+pipe 42 1
+times 43 1
+prof 44 X -
+brk 45 1 - need to save brk_addr & -ve is valid return.
+setgid 46 1
+getgid 47 0
+signal 48 2
+geteuid 49 0
+getegid 50 0
+acct 51 1
+phys 52 X -
+lock 53 X -
+ioctl 54 3
+fcntl 55 3
+mpx 56 X -
+setpgid 57 2
+ulimit 58 2
+oldolduname 59 X -
+umask 60 1
+chroot 61 1
+dv32_ustat 62 2 * Has correct args for 32bit dev_t
+dup2 63 2
+getppid 64 0
+getpgrp 65 0
+setsid 66 0
+sigaction 67 3
+siggetmask 68 0
+sigsetmask 69 1
+setreuid 70 2
+setregid 71 2
+sigsuspend 72 1
+sigpending 73 1
+sethostname 74 2
+setrlimit 75 2
+getrlimit 76 2
+getrusage 77 2
+gettimeofday 78 2
+settimeofday 79 2
+getgroups 80 2
+setgroups 81 2
+select 82 1 * select's arg is &arg1
+symlink 83 2
+oldlstat 84 X -
+readlink 85 3
+uselib 86 1
+swapon 87 2
+reboot 88 3
+readdir 89 3 * Takes the fd not a ddptr
+mmap 90 1 * Is a pointer to a buffer with the 6 args.
+munmap 91 2
+truncate 92 2
+ftruncate 93 2
+fchmod 94 2
+fchown 95 2
+getpriority 96 2
+setpriority 97 3
+profil 98 X - glibc has userspace
+statfs 99 2
+fstatfs 100 2
+ioperm 101 3
+socketcall 102 2 * This is a lib internal for socket stuff
+klog 103 X
+setitimer 104 3
+getitimer 105 2
+dv32_stat 106 2 * Has correct args for 32 bit dev_t
+dv32_lstat 107 2 * Has correct args for 32 bit dev_t
+dv32_fstat 108 2 * Has correct args for 32 bit dev_t
+olduname 109 X -
+iopl 110 1
+vhangup 111 0
+idle 112 0 - System internal
+vm86 113 1
+wait4 114 4
+swapoff 115 1
+sysinfo 116 1
+ipc 117 5 * SYSV ipc entry point
+fsync 118 1
+sigreturn 119 1 * Signal internal
+clone 120 2
+setdomainname 121 2
+uname 122 1
+modify_ldt 123 X
+adjtimex 124 1
+mprotect 125 3
+sigprocmask 126 3
+create_module 127 X - Module handling, NO WAY!
+init_module 128 X
+delete_module 129 X
+get_kernel_syms 130 X
+quotactl 131 X
+getpgid 132 1
+fchdir 133 1
+bdflush 134 2
+sysfs 135 3
+personality 136 1 * Linux specific.
+afs_syscall 137 X
+setfsuid 138 1
+setfsgid 139 1
+_llseek 140 X
+getdents 141 3 * New style readdir ?
+_newselect 142 X
+flock 143 2
+syscall_flock 143 X
diff --git a/libc/gnu_i386/syscall.s b/libc/gnu_i386/syscall.s
new file mode 100644
index 0000000..6180038
--- /dev/null
+++ b/libc/gnu_i386/syscall.s
@@ -0,0 +1,2969 @@
+# Copyright (C) 1995-1997 Robert de Bath <rdebath@cix.compulink.co.uk>
+# This file is part of the Linux-8086 C library and is distributed
+# under the GNU Library General Public License.
+#
+# This file is automatically generated */
+
+# Standard start
+
+
+#ifndef __MSDOS__
+#ifdef __AS386_32__
+ .text
+ .align 16
+# CALL exit 1 1 *
+
+.ifdef L___exit
+.globl __exit
+.type __exit,@function
+__exit:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $1,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL fork 2 0
+
+.ifdef L_fork
+.globl fork
+.type fork,@function
+fork:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $2,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL vfork 2 0 . fake alias of fork
+
+.ifdef L_vfork
+.globl vfork
+.type vfork,@function
+vfork:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $2,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL read 3 3
+
+.ifdef L_read
+.globl read
+.type read,@function
+read:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $3,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL write 4 3
+
+.ifdef L_write
+.globl write
+.type write,@function
+write:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $4,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL open 5 3
+
+.ifdef L_open
+.globl open
+.type open,@function
+open:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $5,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL close 6 1
+
+.ifdef L_close
+.globl close
+.type close,@function
+close:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $6,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL waitpid 7 3
+
+.ifdef L_waitpid
+.globl waitpid
+.type waitpid,@function
+waitpid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $7,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL creat 8 2
+
+.ifdef L_creat
+.globl creat
+.type creat,@function
+creat:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $8,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL link 9 2
+
+.ifdef L_link
+.globl link
+.type link,@function
+link:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $9,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL unlink 10 1
+
+.ifdef L_unlink
+.globl unlink
+.type unlink,@function
+unlink:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $10,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL execve 11 3
+
+.ifdef L_execve
+.globl execve
+.type execve,@function
+execve:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $11,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL chdir 12 1
+
+.ifdef L_chdir
+.globl chdir
+.type chdir,@function
+chdir:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $12,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL time 13 1
+
+.ifdef L_time
+.globl time
+.type time,@function
+time:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $13,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL dv32_mknod 14 3 * has correct args for 32bit dev_t
+
+.ifdef L___dv32_mknod
+.globl __dv32_mknod
+.type __dv32_mknod,@function
+__dv32_mknod:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $14,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL chmod 15 2
+
+.ifdef L_chmod
+.globl chmod
+.type chmod,@function
+chmod:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $15,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL chown 16 3
+
+.ifdef L_chown
+.globl chown
+.type chown,@function
+chown:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $16,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL lseek 19 3
+
+.ifdef L_lseek
+.globl lseek
+.type lseek,@function
+lseek:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $19,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getpid 20 0
+
+.ifdef L_getpid
+.globl getpid
+.type getpid,@function
+getpid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $20,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL mount 21 5
+
+.ifdef L_mount
+.globl mount
+.type mount,@function
+mount:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ push %esi
+ mov 20(%ebp),%esi
+ push %edi
+ mov 24(%ebp),%edi
+ mov $21,%eax
+ int $0x80
+ pop %edi
+ pop %esi
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL umount 22 1
+
+.ifdef L_umount
+.globl umount
+.type umount,@function
+umount:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $22,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setuid 23 1
+
+.ifdef L_setuid
+.globl setuid
+.type setuid,@function
+setuid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $23,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getuid 24 0
+
+.ifdef L_getuid
+.globl getuid
+.type getuid,@function
+getuid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $24,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL stime 25 1
+
+.ifdef L_stime
+.globl stime
+.type stime,@function
+stime:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $25,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL ptrace 26 4
+
+.ifdef L_ptrace
+.globl ptrace
+.type ptrace,@function
+ptrace:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ push %esi
+ mov 20(%ebp),%esi
+ mov $26,%eax
+ int $0x80
+ pop %esi
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL alarm 27 1
+
+.ifdef L_alarm
+.globl alarm
+.type alarm,@function
+alarm:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $27,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL pause 29 0
+
+.ifdef L_pause
+.globl pause
+.type pause,@function
+pause:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $29,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL utime 30 2
+
+.ifdef L_utime
+.globl utime
+.type utime,@function
+utime:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $30,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL access 33 2
+
+.ifdef L_access
+.globl access
+.type access,@function
+access:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $33,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL nice 34 1
+
+.ifdef L_nice
+.globl nice
+.type nice,@function
+nice:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $34,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL ftime 35 1
+
+.ifdef L_ftime
+.globl ftime
+.type ftime,@function
+ftime:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $35,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sync 36 0
+
+.ifdef L_sync
+.globl sync
+.type sync,@function
+sync:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $36,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL kill 37 2
+
+.ifdef L_kill
+.globl kill
+.type kill,@function
+kill:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $37,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL rename 38 2
+
+.ifdef L_rename
+.globl rename
+.type rename,@function
+rename:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $38,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL mkdir 39 2
+
+.ifdef L_mkdir
+.globl mkdir
+.type mkdir,@function
+mkdir:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $39,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL rmdir 40 1
+
+.ifdef L_rmdir
+.globl rmdir
+.type rmdir,@function
+rmdir:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $40,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL dup 41 1
+
+.ifdef L_dup
+.globl dup
+.type dup,@function
+dup:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $41,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL pipe 42 1
+
+.ifdef L_pipe
+.globl pipe
+.type pipe,@function
+pipe:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $42,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL times 43 1
+
+.ifdef L_times
+.globl times
+.type times,@function
+times:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $43,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setgid 46 1
+
+.ifdef L_setgid
+.globl setgid
+.type setgid,@function
+setgid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $46,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getgid 47 0
+
+.ifdef L_getgid
+.globl getgid
+.type getgid,@function
+getgid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $47,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL signal 48 2
+
+.ifdef L_signal
+.globl signal
+.type signal,@function
+signal:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $48,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL geteuid 49 0
+
+.ifdef L_geteuid
+.globl geteuid
+.type geteuid,@function
+geteuid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $49,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getegid 50 0
+
+.ifdef L_getegid
+.globl getegid
+.type getegid,@function
+getegid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $50,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL acct 51 1
+
+.ifdef L_acct
+.globl acct
+.type acct,@function
+acct:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $51,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL ioctl 54 3
+
+.ifdef L_ioctl
+.globl ioctl
+.type ioctl,@function
+ioctl:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $54,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL fcntl 55 3
+
+.ifdef L_fcntl
+.globl fcntl
+.type fcntl,@function
+fcntl:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $55,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setpgid 57 2
+
+.ifdef L_setpgid
+.globl setpgid
+.type setpgid,@function
+setpgid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $57,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL ulimit 58 2
+
+.ifdef L_ulimit
+.globl ulimit
+.type ulimit,@function
+ulimit:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $58,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL umask 60 1
+
+.ifdef L_umask
+.globl umask
+.type umask,@function
+umask:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $60,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL chroot 61 1
+
+.ifdef L_chroot
+.globl chroot
+.type chroot,@function
+chroot:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $61,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL dv32_ustat 62 2 * has correct args for 32bit dev_t
+
+.ifdef L___dv32_ustat
+.globl __dv32_ustat
+.type __dv32_ustat,@function
+__dv32_ustat:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $62,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL dup2 63 2
+
+.ifdef L_dup2
+.globl dup2
+.type dup2,@function
+dup2:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $63,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getppid 64 0
+
+.ifdef L_getppid
+.globl getppid
+.type getppid,@function
+getppid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $64,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getpgrp 65 0
+
+.ifdef L_getpgrp
+.globl getpgrp
+.type getpgrp,@function
+getpgrp:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $65,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setsid 66 0
+
+.ifdef L_setsid
+.globl setsid
+.type setsid,@function
+setsid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $66,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sigaction 67 3
+
+.ifdef L_sigaction
+.globl sigaction
+.type sigaction,@function
+sigaction:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $67,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL siggetmask 68 0
+
+.ifdef L_siggetmask
+.globl siggetmask
+.type siggetmask,@function
+siggetmask:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $68,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sigsetmask 69 1
+
+.ifdef L_sigsetmask
+.globl sigsetmask
+.type sigsetmask,@function
+sigsetmask:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $69,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setreuid 70 2
+
+.ifdef L_setreuid
+.globl setreuid
+.type setreuid,@function
+setreuid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $70,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setregid 71 2
+
+.ifdef L_setregid
+.globl setregid
+.type setregid,@function
+setregid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $71,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sigsuspend 72 1
+
+.ifdef L_sigsuspend
+.globl sigsuspend
+.type sigsuspend,@function
+sigsuspend:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $72,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sigpending 73 1
+
+.ifdef L_sigpending
+.globl sigpending
+.type sigpending,@function
+sigpending:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $73,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sethostname 74 2
+
+.ifdef L_sethostname
+.globl sethostname
+.type sethostname,@function
+sethostname:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $74,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setrlimit 75 2
+
+.ifdef L_setrlimit
+.globl setrlimit
+.type setrlimit,@function
+setrlimit:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $75,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getrlimit 76 2
+
+.ifdef L_getrlimit
+.globl getrlimit
+.type getrlimit,@function
+getrlimit:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $76,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getrusage 77 2
+
+.ifdef L_getrusage
+.globl getrusage
+.type getrusage,@function
+getrusage:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $77,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL gettimeofday 78 2
+
+.ifdef L_gettimeofday
+.globl gettimeofday
+.type gettimeofday,@function
+gettimeofday:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $78,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL settimeofday 79 2
+
+.ifdef L_settimeofday
+.globl settimeofday
+.type settimeofday,@function
+settimeofday:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $79,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getgroups 80 2
+
+.ifdef L_getgroups
+.globl getgroups
+.type getgroups,@function
+getgroups:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $80,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setgroups 81 2
+
+.ifdef L_setgroups
+.globl setgroups
+.type setgroups,@function
+setgroups:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $81,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL select 82 1 * select's arg is &arg1
+
+.ifdef L___select
+.globl __select
+.type __select,@function
+__select:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $82,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL symlink 83 2
+
+.ifdef L_symlink
+.globl symlink
+.type symlink,@function
+symlink:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $83,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL readlink 85 3
+
+.ifdef L_readlink
+.globl readlink
+.type readlink,@function
+readlink:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $85,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL uselib 86 1
+
+.ifdef L_uselib
+.globl uselib
+.type uselib,@function
+uselib:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $86,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL swapon 87 2
+
+.ifdef L_swapon
+.globl swapon
+.type swapon,@function
+swapon:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $87,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL reboot 88 3
+
+.ifdef L_reboot
+.globl reboot
+.type reboot,@function
+reboot:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $88,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL readdir 89 3 * takes the fd not a ddptr
+
+.ifdef L___readdir
+.globl __readdir
+.type __readdir,@function
+__readdir:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $89,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL mmap 90 1 * is a pointer to a buffer with the 6 args.
+
+.ifdef L___mmap
+.globl __mmap
+.type __mmap,@function
+__mmap:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $90,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL munmap 91 2
+
+.ifdef L_munmap
+.globl munmap
+.type munmap,@function
+munmap:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $91,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL truncate 92 2
+
+.ifdef L_truncate
+.globl truncate
+.type truncate,@function
+truncate:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $92,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL ftruncate 93 2
+
+.ifdef L_ftruncate
+.globl ftruncate
+.type ftruncate,@function
+ftruncate:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $93,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL fchmod 94 2
+
+.ifdef L_fchmod
+.globl fchmod
+.type fchmod,@function
+fchmod:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $94,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL fchown 95 2
+
+.ifdef L_fchown
+.globl fchown
+.type fchown,@function
+fchown:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $95,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getpriority 96 2
+
+.ifdef L_getpriority
+.globl getpriority
+.type getpriority,@function
+getpriority:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $96,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setpriority 97 3
+
+.ifdef L_setpriority
+.globl setpriority
+.type setpriority,@function
+setpriority:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $97,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL statfs 99 2
+
+.ifdef L_statfs
+.globl statfs
+.type statfs,@function
+statfs:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $99,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL fstatfs 100 2
+
+.ifdef L_fstatfs
+.globl fstatfs
+.type fstatfs,@function
+fstatfs:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $100,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL ioperm 101 3
+
+.ifdef L_ioperm
+.globl ioperm
+.type ioperm,@function
+ioperm:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $101,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL socketcall 102 2 * this is a lib internal for socket stuff
+
+.ifdef L___socketcall
+.globl __socketcall
+.type __socketcall,@function
+__socketcall:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $102,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setitimer 104 3
+
+.ifdef L_setitimer
+.globl setitimer
+.type setitimer,@function
+setitimer:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $104,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getitimer 105 2
+
+.ifdef L_getitimer
+.globl getitimer
+.type getitimer,@function
+getitimer:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $105,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL dv32_stat 106 2 * has correct args for 32 bit dev_t
+
+.ifdef L___dv32_stat
+.globl __dv32_stat
+.type __dv32_stat,@function
+__dv32_stat:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $106,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL dv32_lstat 107 2 * has correct args for 32 bit dev_t
+
+.ifdef L___dv32_lstat
+.globl __dv32_lstat
+.type __dv32_lstat,@function
+__dv32_lstat:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $107,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL dv32_fstat 108 2 * has correct args for 32 bit dev_t
+
+.ifdef L___dv32_fstat
+.globl __dv32_fstat
+.type __dv32_fstat,@function
+__dv32_fstat:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $108,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL iopl 110 1
+
+.ifdef L_iopl
+.globl iopl
+.type iopl,@function
+iopl:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $110,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL vhangup 111 0
+
+.ifdef L_vhangup
+.globl vhangup
+.type vhangup,@function
+vhangup:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov $111,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL vm86 113 1
+
+.ifdef L_vm86
+.globl vm86
+.type vm86,@function
+vm86:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $113,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL wait4 114 4
+
+.ifdef L_wait4
+.globl wait4
+.type wait4,@function
+wait4:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ push %esi
+ mov 20(%ebp),%esi
+ mov $114,%eax
+ int $0x80
+ pop %esi
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL swapoff 115 1
+
+.ifdef L_swapoff
+.globl swapoff
+.type swapoff,@function
+swapoff:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $115,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sysinfo 116 1
+
+.ifdef L_sysinfo
+.globl sysinfo
+.type sysinfo,@function
+sysinfo:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $116,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL ipc 117 5 * sysv ipc entry point
+
+.ifdef L___ipc
+.globl __ipc
+.type __ipc,@function
+__ipc:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ push %esi
+ mov 20(%ebp),%esi
+ push %edi
+ mov 24(%ebp),%edi
+ mov $117,%eax
+ int $0x80
+ pop %edi
+ pop %esi
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL fsync 118 1
+
+.ifdef L_fsync
+.globl fsync
+.type fsync,@function
+fsync:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $118,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sigreturn 119 1 * signal internal
+
+.ifdef L___sigreturn
+.globl __sigreturn
+.type __sigreturn,@function
+__sigreturn:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $119,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL clone 120 2
+
+.ifdef L_clone
+.globl clone
+.type clone,@function
+clone:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $120,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setdomainname 121 2
+
+.ifdef L_setdomainname
+.globl setdomainname
+.type setdomainname,@function
+setdomainname:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $121,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL uname 122 1
+
+.ifdef L_uname
+.globl uname
+.type uname,@function
+uname:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $122,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL adjtimex 124 1
+
+.ifdef L_adjtimex
+.globl adjtimex
+.type adjtimex,@function
+adjtimex:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $124,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL mprotect 125 3
+
+.ifdef L_mprotect
+.globl mprotect
+.type mprotect,@function
+mprotect:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $125,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sigprocmask 126 3
+
+.ifdef L_sigprocmask
+.globl sigprocmask
+.type sigprocmask,@function
+sigprocmask:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $126,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getpgid 132 1
+
+.ifdef L_getpgid
+.globl getpgid
+.type getpgid,@function
+getpgid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $132,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL fchdir 133 1
+
+.ifdef L_fchdir
+.globl fchdir
+.type fchdir,@function
+fchdir:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $133,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL bdflush 134 2
+
+.ifdef L_bdflush
+.globl bdflush
+.type bdflush,@function
+bdflush:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $134,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL sysfs 135 3
+
+.ifdef L_sysfs
+.globl sysfs
+.type sysfs,@function
+sysfs:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $135,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL personality 136 1 * linux specific.
+
+.ifdef L___personality
+.globl __personality
+.type __personality,@function
+__personality:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $136,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setfsuid 138 1
+
+.ifdef L_setfsuid
+.globl setfsuid
+.type setfsuid,@function
+setfsuid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $138,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL setfsgid 139 1
+
+.ifdef L_setfsgid
+.globl setfsgid
+.type setfsgid,@function
+setfsgid:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov $139,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL getdents 141 3 * new style readdir ?
+
+.ifdef L___getdents
+.globl __getdents
+.type __getdents,@function
+__getdents:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov 16(%ebp),%edx
+ mov $141,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+# CALL flock 143 2
+
+.ifdef L_flock
+.globl flock
+.type flock,@function
+flock:
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %ebx
+ mov 8(%ebp),%ebx
+ mov 12(%ebp),%ecx
+ mov $143,%eax
+ int $0x80
+ pop %ebx
+ test %eax,%eax
+ jge syscall_ok
+ neg %eax
+ mov %eax,errno
+ mov $-1,%eax
+syscall_ok:
+ movl %ebp,%esp
+ popl %ebp
+ ret
+.endif
+
+#endif /* __AS386_32__ */
+
+#endif /* __MSDOS__ */
+