diff options
author | Robert de Bath <rdebath@poboxes.com> | 1997-02-25 20:42:19 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:38:07 +0200 |
commit | 4c36e9a0c125ccfff37aa440dab2cf58c4152fff (patch) | |
tree | a5d9c84ba2661029ddb2223dacd50529a361c3d5 /libc/syscall | |
parent | f8de35da65c5d93bb733073cf40da154bc1c0748 (diff) | |
parent | 9696d7b0e1f3a1b0f5fd4a0428eb75afe8ad4ed6 (diff) | |
download | dev86-4c36e9a0c125ccfff37aa440dab2cf58c4152fff.tar.gz |
Import Dev86src-0.0.11.tar.gzv0.0.11
Diffstat (limited to 'libc/syscall')
-rw-r--r-- | libc/syscall/Makefile | 70 | ||||
-rw-r--r-- | libc/syscall/TODO | 2 | ||||
-rw-r--r-- | libc/syscall/getinfo.c | 32 | ||||
-rw-r--r-- | libc/syscall/mksys386 | 152 | ||||
-rw-r--r-- | libc/syscall/mksyscall | 25 | ||||
-rw-r--r-- | libc/syscall/setjmp.c | 6 | ||||
-rw-r--r-- | libc/syscall/sys386.dat | 155 | ||||
-rw-r--r-- | libc/syscall/syscall.dat.chad | 55 | ||||
-rw-r--r-- | libc/syscall/syscall.dat.code | 70 | ||||
-rw-r--r-- | libc/syscall/syscall.dat.rdb | 142 | ||||
-rw-r--r-- | libc/syscall/syslib0.c | 20 | ||||
-rw-r--r-- | libc/syscall/syslib3.c | 109 | ||||
-rw-r--r-- | libc/syscall/syslibc.c | 13 |
13 files changed, 333 insertions, 518 deletions
diff --git a/libc/syscall/Makefile b/libc/syscall/Makefile index b487655..fd1b187 100644 --- a/libc/syscall/Makefile +++ b/libc/syscall/Makefile @@ -2,67 +2,63 @@ # This file is part of the Linux-8086 C library and is distributed # under the GNU Library General Public License. -TOP=.. -include $(TOP)/Make.defs - LSRC=syslibc.c -LOBJ=time.o abort.o wait.o waitpid.o killpg.o setpgrp.o sleep.o \ +LOBJ=time.o abort.o wait.o waitpid.o wait3.o killpg.o setpgrp.o sleep.o \ usleep.o -LSRC3=syslib3.c -LOBJ3=__cstart3.o - LSRC0=syslib0.c LOBJ0=__cstartup.o lseek.o getpid.o getppid.o getuid.o geteuid.o getgid.o \ getegid.o dup2.o dup.o getpgrp.o times.o ESRC=exec.c -E2OBJ=execl.o execv.o execle.o execlp.o execvp.o -EOBJ=execve.o $(E2OBJ) +EOBJ=execve.o execl.o execv.o execle.o execlp.o execvp.o DSRC=dirent.c DOBJ=opendir.o closedir.o readdir.o ifeq ($(LIB_CPU)-$(LIB_OS),i86-ELKS) -SYSCALLS=sh mksyscall OBJ=$(LOBJ0) $(LOBJ) $(DOBJ) $(EOBJ) signal.o setjmp.o -DEP=mksyscall syscall.dat -endif - -ifeq ($(LIB_CPU)-$(LIB_OS),i386-ELKS) -SYSCALLS=sh mksys386 -OBJ=setjmp.o $(LOBJ3) $(LOBJ) $(E2OBJ) $(DOBJ) -DEP=mksys386 sys386.dat +SYSCALLS=call_i86 endif ifeq ($(SYSCALLS),) -SYSCALLS=true OBJ=setjmp.o -DEP= endif -all: $(DEP) $(OBJ) - $(SYSCALLS) +CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS) -libc.a: $(DEP) $(OBJ) - $(SYSCALLS) libc.a - ar r ../$(LIBC) $(OBJ) - @touch libc.a +all: $(SYSCALLS) $(LIBC) + @: -clean: - rm -f *.o libc.a syscall.c syscall.mak call_tab.v defn_tab.v +call_i86: syscall.mak + $(MAKE) -f syscall.mak LIBC="$(LIBC)" CFLAGS="$(CFLAGS)" + +syscall.mak: mksyscall syscall.dat + sh mksyscall -$(LOBJ): $(LSRC) - $(CC) $(CFLAGS) -c -DL_$* -o $@ $(LSRC) +$(LIBC): $(LIBC)($(OBJ)) -$(DOBJ): $(DSRC) - $(CC) $(CFLAGS) -c -DL_$* -o $@ $(DSRC) +$(LIBC)($(LOBJ)): $(LSRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(AR) $(ARFLAGS) $@ $*.o + $(RM) $*.o -$(EOBJ): $(ESRC) - $(CC) $(CFLAGS) -c -DL_$* -o $@ $(ESRC) +$(LIBC)($(DOBJ)): $(DSRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(AR) $(ARFLAGS) $@ $*.o + $(RM) $*.o -$(LOBJ0): $(LSRC0) - $(CC) $(CFLAGS) -c -DL_$* -o $@ $(LSRC0) +$(LIBC)($(EOBJ)): $(ESRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(AR) $(ARFLAGS) $@ $*.o + $(RM) $*.o -$(LOBJ3): $(LSRC3) - $(CC) $(CFLAGS) -c -DL_$* -o $@ $(LSRC3) +$(LIBC)($(LOBJ0)): $(LSRC0) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(AR) $(ARFLAGS) $@ $*.o + $(RM) $*.o + +clean: + rm -f *.o libc.a + rm -f syscall.c syscall.mak + rm -f call_tab.v defn_tab.v diff --git a/libc/syscall/TODO b/libc/syscall/TODO index 90085d9..b178a96 100644 --- a/libc/syscall/TODO +++ b/libc/syscall/TODO @@ -1,5 +1,3 @@ -It appears that a 386 version of the syscall libs is also wanted ... - SYSV IPC, there's and __ipc syscall and the hardware can manage messages and semaphores. diff --git a/libc/syscall/getinfo.c b/libc/syscall/getinfo.c deleted file mode 100644 index a5ab89a..0000000 --- a/libc/syscall/getinfo.c +++ /dev/null @@ -1,32 +0,0 @@ - -#define PERM_GETINFO 0x100 -#define PERM_GETGROUP 0x200 - -struct { - int pid; - int ppid; - int uid; - int gid; - int euid; - int egid; -} - __info_safe; - -getgroups(count, locn) -int count; -void * locn; -{ - if( count < 0 ) {errno = EINVAL; return -1; } - return __permissions(PERM_GETGROUP, count, locn); -} - -getpid() -{ - __permissions(PERM_GETINFO, 6, &__info_safe); - return __info_safe.pid; -} - -getppid() -{ - return __permissions(PERM_GETITEM(1) /*, 0, 0 */); -} diff --git a/libc/syscall/mksys386 b/libc/syscall/mksys386 deleted file mode 100644 index 5abcbf8..0000000 --- a/libc/syscall/mksys386 +++ /dev/null @@ -1,152 +0,0 @@ -# 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. -# -# 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 call_tab.v defn_tab.v - -tr '[A-Z]' '[a-z]' < sys386.dat | \ -awk 'BEGIN{ - print "# Copyright (C) 1995,1996 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,1996 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("#asm\n"); - printf(" .text\n"); - printf(" .align 4\n"); - printf("#endasm\n\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("#asm\n"); - printf("export _%s\n", funcname); - printf("_%s:\n", funcname); - - # Inline assembler max to 5 args (20 bytes) - if( $3 != 4 && $3 != 5 && ( COMPACT || $3 > 5 )) - { - if( $3 == 0 ) - { - printf(" mov eax,#%d\n", $2); - } - else - { - printf("#if __FIRST_ARG_IN_AX__\n"); - printf(" mov edx,#%d\n", $2); - printf("#else\n"); - printf(" mov eax,#%d\n", $2); - printf("#endif\n"); - } - printf(" br sys_call%d\n", $3); - } - else - { - if( $3 >= 1 ) printf("#if __FIRST_ARG_IN_AX__\n"); - if( $3 >= 1 ) printf(" mov ebx,eax\n"); - if( $3 >= 2 ) printf(" mov ecx,[esp+4]\n"); - if( $3 >= 3 ) printf(" mov edx,[esp+8]\n"); - if( $3 >= 4 ) printf(" push esi\n"); - if( $3 >= 4 ) printf(" mov esi,[esp+16]\n"); - if( $3 >= 5 ) printf(" push edi\n"); - if( $3 >= 5 ) printf(" mov edi,[esp+24]\n"); - if( $3 >= 1 ) printf("#else\n"); - if( $3 >= 1 ) printf(" mov ebx,[esp+4]\n"); - if( $3 >= 2 ) printf(" mov ecx,[esp+8]\n"); - if( $3 >= 3 ) printf(" mov edx,[esp+12]\n"); - if( $3 >= 4 ) printf(" push esi\n"); - if( $3 >= 4 ) printf(" mov esi,[esp+20]\n"); - if( $3 >= 5 ) printf(" push edi\n"); - if( $3 >= 5 ) printf(" mov edi,[esp+28]\n"); - if( $3 >= 1 ) printf("#endif\n"); - printf(" mov eax,#%d\n", $2); - printf(" int $80\n"); - - if( $3 >= 5 ) printf(" pop edi\n"); - if( $3 >= 4 ) printf(" pop esi\n"); - - printf(" test eax,eax\n"); - printf(" jl syscall_err\n"); - printf(" ret\n"); - printf("syscall_err:\n"); - printf(" neg eax\n"); - printf(" mov [_errno],eax\n"); - printf(" mov eax,#-1\n"); - printf(" ret\n"); - } - printf("#endasm\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.c - -cat >> syscall.mak <<\! - -TOP=.. -include $(TOP)/Make.defs - -all: $(OBJ) - -libc.a: $(OBJ) - ar r ../$(LIBC) $(OBJ) - @touch libc.a - -$(OBJ): sys386.dat mksys386 - $(CC) $(CFLAGS) -c -DL_$* -o $@ syscall.c -! - -rv=$? -if [ "$rv" != 0 ] -then exit $rv -fi - -export MAKELEVEL -MAKELEVEL=0 -exec make -f syscall.mak $1 diff --git a/libc/syscall/mksyscall b/libc/syscall/mksyscall index 1e98836..2005029 100644 --- a/libc/syscall/mksyscall +++ b/libc/syscall/mksyscall @@ -277,24 +277,13 @@ END{ cat >> syscall.mak <<\! -TOP=.. -include $(TOP)/Make.defs +all: $(LIBC)($(OBJ)) + @: -all: $(OBJ) - -libc.a: $(OBJ) - ar r ../$(LIBC) $(OBJ) - @touch libc.a - -$(OBJ): syscall.dat mksyscall - $(CC) $(CFLAGS) -c -DL_$* -o $@ syscall.c +$(LIBC)($(OBJ)): syscall.dat + $(CC) $(CFLAGS) -DL_$* syscall.c -c -o $*.o + $(AR) $(ARFLAGS) $@ $*.o + $(RM) $*.o ! -rv=$? -if [ "$rv" != 0 ] -then exit $rv -fi - -export MAKELEVEL -MAKELEVEL=0 -exec make -f syscall.mak $1 +exit $? diff --git a/libc/syscall/setjmp.c b/libc/syscall/setjmp.c index 52c3ff1..58b57ad 100644 --- a/libc/syscall/setjmp.c +++ b/libc/syscall/setjmp.c @@ -8,6 +8,9 @@ setjmp(env) jmp_buf env; { #asm +export __setjmp +__setjmp: + pop cx ! PC #if __FIRST_ARG_IN_AX__ mov bx,ax @@ -31,6 +34,9 @@ jmp_buf env; int rv; { #asm +export __longjmp +__longjmp: + pop cx ! pc #if __FIRST_ARG_IN_AX__ mov bx,ax ! env-> diff --git a/libc/syscall/sys386.dat b/libc/syscall/sys386.dat deleted file mode 100644 index da9ad6c..0000000 --- a/libc/syscall/sys386.dat +++ /dev/null @@ -1,155 +0,0 @@ - -# -# 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/syscall/syscall.dat.chad b/libc/syscall/syscall.dat.chad new file mode 100644 index 0000000..a6e8b06 --- /dev/null +++ b/libc/syscall/syscall.dat.chad @@ -0,0 +1,55 @@ +exit 1 1 * c exit does stdio, _exit in crt0 +fork 2 0 +read 3 3 +write 4 3 +open 5 3 +close 6 1 +wait 7 0 . THIS one is different +creat 8 0 . THIS one is different +link 9 2 +unlink 10 1 +exec 11 3 * minix style exec +chdir 12 1 +time 13 0 . THIS one is different +mknod 14 3 +chmod 15 2 +chown 16 3 +brk 17 1 * This is only to tell the system +stat 18 2 +lseek 19 3 * nb 2nd arg is an io ptr to long not a long. +getpid 20 1 * this gets both pid & ppid +mount 21 5 +umount 22 1 +setuid 23 1 +getuid 24 1 * this gets both uid and euid +stime 25 2 - this must not exist - even as a libc. +ptrace 26 4 +alarm 27 2 +fstat 28 2 +pause 29 0 +utime 30 2 +access 33 2 +nice 34 1 . +sleep 35 0 . THIS one is different +sync 36 0 +kill 37 2 +rename 38 2 +mkdir 39 2 +rmdir 40 1 +dup 41 1 - using nasty fcntl function +pipe 42 1 +times 43 2 * 2nd arg is pointer for long ret val. +profil 44 0 +setgid 46 1 +getgid 47 1 * this gets both gid and egid +signal 48 2 * have put the despatch table in user space. +getinfo 49 1 - possible? gets pid,ppid,uid,euid etc +fcntl 50 3 +acct 51 1 - +phys 52 0 . THIS one is different +lock 53 0 . THIS one is different +ioctl 54 3 . make this and fcntl the same ? +reboot 55 3 . the magic number is 0xfee1,0xdead,... +mpx 56 0 . THIS one is different +dup2 57 0 . THIS one is different +umask 60 1 diff --git a/libc/syscall/syscall.dat.code b/libc/syscall/syscall.dat.code new file mode 100644 index 0000000..a91ca86 --- /dev/null +++ b/libc/syscall/syscall.dat.code @@ -0,0 +1,70 @@ +( +tr '[A-Z]' '[a-z]' < syscall.dat.rdb +echo %%% +cat <<! +exit 1 0 +fork 2 0 +read 3 0 +write 4 0 +open 5 0 +close 6 0 +wait 7 0 +creat 8 0 +link 9 0 +unlink 10 0 +exec 11 0 +chdir 12 0 +time 13 0 +mknod 14 0 +chmod 15 0 +chown 16 0 +brk 17 0 +stat 18 0 +lseek 19 0 +getpid 20 0 +mount 21 0 +umount 22 0 +setuid 23 0 +getuid 24 0 +stime 25 0 +ptrace 26 0 +alarm 27 0 +fstat 28 0 +pause 29 0 +utime 30 0 +access 33 0 +nice 34 0 +sleep 35 0 +sync 36 0 +kill 37 0 +rename 38 0 +mkdir 39 0 +rmdir 40 0 +dup 41 0 +pipe 42 0 +times 43 0 +profil 44 0 +setgid 46 0 +getgid 47 0 +signal 48 0 +getinfo 49 0 +fcntl 50 0 +acct 51 0 +phys 52 0 +lock 53 0 +ioctl 54 0 +reboot 55 0 +mpx 56 0 +dup2 57 0 +umask 60 0 +! +) | awk '/%%%/{ flg++; OFS="\t"; next;} +flg==0 { save4[$1] = $4; save3[$1] = $3; + for(i=5; i<=NF; i++) saverest[$1] = saverest[$1] " " $i; +} +flg==1 { + if( $1 in save3 ) + print $1, $2, save3[$1]+0, save4[$1] " " saverest[$1] ; + else + print $1, $2, "0", ". THIS one is different"; + }' diff --git a/libc/syscall/syscall.dat.rdb b/libc/syscall/syscall.dat.rdb new file mode 100644 index 0000000..de5ed9b --- /dev/null +++ b/libc/syscall/syscall.dat.rdb @@ -0,0 +1,142 @@ +# +# Name No Args Flag, comment +# +# . = Ok, with comment +# * = Needs libc code (Prefix __) +# - = Obsolete/not required +# +# WARNING! +# This file is used to generate includes for ELKSemu too. +# This file is continually changing, when you upgrade you _MUST_ ensure +# that ELKSemu is of a matching build! +# +# Calls that use one fd +READ 3 3 +WRITE 4 3 +CLOSE 6 1 +LSEEK 19 3 * NB 2nd arg is an IO ptr to long not a long. +FSTAT 28 2 +IOCTL 54 3 . Make this and fcntl the same ? +FCNTL 55 3 +FTRUNCATE 93 3 +FCHMOD 94 2 +FCHOWN 95 3 +FSYNC 118 1 +FCHDIR 133 1 +LLSEEK 140 3 * 2nd arg is ptr to two longs +READV 145 3 +WRITEV 146 3 +FLOCK 143 2 - Use fcntl +DUP 41 1 - Using nasty fcntl function + +# +SETUP 0 X +EXIT 1 1 * C exit does stdio, _exit in crt0 +FORK 2 0 +OPEN 5 3 +WAIT4 7 4 +VFORK 8 0 . Needed for 8086 +GETINFO 49 1 - Possible? Gets pid,ppid,uid,euid etc +LINK 9 2 +UNLINK 10 1 +EXEC 11 3 * Minix style exec +CHDIR 12 1 +GETTIMEOFDAY 13 2 . time() exists only in libc +MKNOD 14 3 +CHMOD 15 2 +CHOWN 16 3 +BRK 17 1 * This is only to tell the system +STAT 18 2 +GETPID 20 1 * This gets both pid & ppid +MOUNT 21 5 +UMOUNT 22 1 +SETUID 23 1 +GETUID 24 1 * This gets both uid and euid +SETTIMEOFDAY 25 2 . STIME should _NOT_ exist even as a libc. +STIME 25 2 - This must NOT exist - even as a libc. +PTRACE 26 4 +ALARM 27 2 +PAUSE 29 0 +UTIME 30 2 +ACCESS 33 2 +NICE 34 1 . +FTIME 35 1 - Use gettimeofday +SYNC 36 0 +KILL 37 2 +RENAME 38 2 +MKDIR 39 2 +RMDIR 40 1 +PIPE 42 1 +TIMES 43 2 * 2nd arg is pointer for long ret val. +SETGID 46 1 +GETGID 47 1 * This gets both gid and egid +SIGNAL 48 2 * Have put the despatch table in user space. +ACCT 51 1 - +SETPGID 57 2 +ULIMIT 58 2 +UMASK 60 1 +CHROOT 61 1 +USTAT 62 2 +GETPGRP 65 0 - use getpgid(0) +SETSID 66 0 +SIGACTION 67 X +SGETMASK 68 X +SSETMASK 69 X +SETREUID 70 2 +SETREGID 71 2 +SIGSUSPEND 72 X +SIGPENDING 73 X +SETHOSTNAME 74 2 +SETRLIMIT 75 2 +GETRLIMIT 76 2 +GETRUSAGE 77 2 +GETGROUPS 80 2 +SETGROUPS 81 2 +SYMLINK 83 2 +LSTAT 84 2 +READLINK 85 3 +SWAPON 87 X +REBOOT 88 3 . The magic number is 0xfee1,0xdead,... +MUNMAP 91 X +TRUNCATE 92 3 +GETPRIORITY 96 2 +SETPRIORITY 97 3 +PROFIL 98 X +STATFS 99 2 +FSTATFS 100 2 +SOCKETCALL 102 X +SYSLOG 103 X +SETITIMER 104 3 +GETITIMER 105 2 +UNAME 109 1 +VHANGUP 111 0 +SWAPOFF 115 X +SYSINFO 116 X - Use /proc +IPC 117 5 * This is for all SYSV IPC +SIGRETURN 119 X +SETDOMAINNAME 121 X +ADJTIMEX 124 X +MPROTECT 125 X +SIGPROCMASK 126 X +QUOTACTL 131 X +GETPGID 132 1 +SYSFS 135 X +PERSONALITY 136 X +SETFSUID 138 1 +SETFSGID 139 1 +GETDENTS 141 X +SELECT 142 5 * +MSYNC 144 X +GETSID 147 X +FDATASYNC 148 X +SYSCTL 149 X +MUNLOCK 151 X +MUNLOCKALL 153 X +SCHED_SETPARAM 154 X +SCHED_GETPARAM 155 X +SCHED_SETSCHEDULER 156 X +SCHED_GETSCHEDULER 157 X +SCHED_YIELD 158 X +SCHED_GET_PRIORITY_MAX 159 X +SCHED_GET_PRIORITY_MIN 160 X +SCHED_RR_GET_INTERVAL 161 X diff --git a/libc/syscall/syslib0.c b/libc/syscall/syslib0.c index 98f59e6..1a92179 100644 --- a/libc/syscall/syslib0.c +++ b/libc/syscall/syslib0.c @@ -29,11 +29,9 @@ call_main: saved_arg1: .word 0 #endif -#if __CALLER_SAVES__ .data -loopy_safe: +loop_safe: .word 0 -#endif .text export ___cstartup @@ -57,24 +55,20 @@ ___mkargv: ! BCC tells the linker to init argc,argv with this. push cx ! Push argc #endif - mov si,#auto_start ! Pointer to first autostart function + mov bx,#auto_start ! Pointer to first autostart function auto_run: #if __FIRST_ARG_IN_AX__ mov ax,[saved_arg1] #endif -#if __CALLER_SAVES__ - mov [loopy_safe],si -#endif - mov bx,[si] + mov [loop_safe],bx + mov bx,[bx] test bx,bx jz no_entry call bx ! Call the function no_entry: -#if __CALLER_SAVES__ - mov si,[loopy_safe] -#endif - inc si ! SI at next - inc si + mov bx,[loop_safe] + inc bx ! next + inc bx jmp auto_run ! And round for the next. call_exit: ! Last item called by above. diff --git a/libc/syscall/syslib3.c b/libc/syscall/syslib3.c deleted file mode 100644 index c4df1fc..0000000 --- a/libc/syscall/syslib3.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 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. - */ - -#include <sys/types.h> -#include <errno.h> -#include <time.h> -#include <sys/times.h> - -/* MSDOS has it's own versions */ -#ifndef __MSDOS__ -#ifdef __AS386_32__ - -/********************** Function __cstartup *******************************/ - -#ifdef L___cstart3 - -void (*__cleanup)() = 0; -char ** environ; - -#asm - loc 2 -call_main: - .long _main ! Segment 2 is the trailing pointers, main and the - .long call_exit ! routine to call exit. -#if __FIRST_ARG_IN_AX__ - .data -saved_arg1: - .long 0 -#endif -#if __CALLER_SAVES__ - .data -loopy_safe: - .long 0 -#endif - .text - -export ___mkargv -___mkargv: ! BCC Tells linker to init argv ... none needed. - -export ___cstartup -___cstartup: ! Crt0 startup (Linux style) - mov eax,[esp] - test eax,eax - jz call_exit ! If argc == 0 this is being called by ldd, exit. - mov eax,[esp+8] - mov [_environ],eax -#if __FIRST_ARG_IN_AX__ - pop [saved_arg1] ! Argc will go into eax -#endif - - mov esi,#auto_start ! Pointer to first autostart function -auto_run: -#if __FIRST_ARG_IN_AX__ - mov eax,[saved_arg1] -#endif -#if __CALLER_SAVES__ - mov [loopy_safe],esi -#endif - mov ebx,[esi] - test ebx,ebx - jz no_func - call ebx ! Call the function -no_func: -#if __CALLER_SAVES__ - mov esi,[loopy_safe] -#endif - add esi,#4 ! SI at next - jmp auto_run ! And round for the next. - -call_exit: ! Last item called by above. - pop ebx ! Be tidy. -#if !__FIRST_ARG_IN_AX__ - push eax ! At the end the last called was main() push it`s -#endif - call _exit ! return val and call exit(); -bad_exit: - jmp bad_exit ! Exit returned !! - -export _exit -export __exit -_exit: ! exit(rv) function -#if __FIRST_ARG_IN_AX__ - mov [saved_arg1],eax -#else - push [esp+4] ! Copy the `rv` for the exit fuctions. -#endif - mov ebx,[___cleanup] ! Call exit, normally this is `__do_exit` - test ebx,ebx - je no_clean ! But it`s default is null - call ebx -no_clean: -#if __FIRST_ARG_IN_AX__ - mov eax,[saved_arg1] -#else - add esp,#4 -#endif -__exit: ! _exit(rv) - br ___exit ! This is just an alias for __exit(); - -#endasm -#endif - -/********************** Function ? ************************************/ - -/*---*/ -#endif -#endif diff --git a/libc/syscall/syslibc.c b/libc/syscall/syslibc.c index 68f5a0b..3486ef6 100644 --- a/libc/syscall/syslibc.c +++ b/libc/syscall/syslibc.c @@ -50,6 +50,19 @@ int * status; } #endif +/********************** Function wait3 **************************************/ + +#ifdef L_wait3 +int +wait3(status, opts, usage) +int * status; +int opts; +struct rusage * usage; +{ + return wait4(-1, status, opts, usage); +} +#endif + /********************** Function waitpid ************************************/ #ifdef L_waitpid |