From 48252cc673b73dc3d9df1b104ce48b09f0d67573 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 10 Oct 1989 11:40:55 +0000 Subject: [PATCH] initial version --- mach/i386/libsys/.distr | 5 +++ mach/i386/libsys/LIST | 69 +++++++++++++++++++++++++++++++++++++ mach/i386/libsys/Makefile | 28 +++++++++++++++ mach/i386/libsys/TODO | 2 ++ mach/i386/libsys/_exit.s | 7 ++++ mach/i386/libsys/_pipe.s | 12 +++++++ mach/i386/libsys/_profil.s | 6 ++++ mach/i386/libsys/_stime.s | 6 ++++ mach/i386/libsys/_time.s | 6 ++++ mach/i386/libsys/_wait.s | 12 +++++++ mach/i386/libsys/access.s | 6 ++++ mach/i386/libsys/acct.s | 6 ++++ mach/i386/libsys/alarm.s | 6 ++++ mach/i386/libsys/brk.s | 13 +++++++ mach/i386/libsys/chdir.s | 6 ++++ mach/i386/libsys/chmod.s | 6 ++++ mach/i386/libsys/chown.s | 6 ++++ mach/i386/libsys/chroot.s | 6 ++++ mach/i386/libsys/cleanup.c | 1 + mach/i386/libsys/close.s | 6 ++++ mach/i386/libsys/compmodule | 4 +++ mach/i386/libsys/creat.s | 6 ++++ mach/i386/libsys/dup.c | 5 +++ mach/i386/libsys/dup2.c | 6 ++++ mach/i386/libsys/execl.c | 9 +++++ mach/i386/libsys/execle.c | 10 ++++++ mach/i386/libsys/execv.c | 8 +++++ mach/i386/libsys/execve.s | 7 ++++ mach/i386/libsys/exit.c | 5 +++ mach/i386/libsys/fcntl.s | 6 ++++ mach/i386/libsys/fork.s | 18 ++++++++++ mach/i386/libsys/fstat.s | 6 ++++ mach/i386/libsys/ftime.s | 6 ++++ mach/i386/libsys/getegid.s | 11 ++++++ mach/i386/libsys/geteuid.s | 11 ++++++ mach/i386/libsys/getgid.s | 6 ++++ mach/i386/libsys/getpgrp.s | 10 ++++++ mach/i386/libsys/getpid.s | 6 ++++ mach/i386/libsys/getppid.s | 11 ++++++ mach/i386/libsys/getuid.s | 6 ++++ mach/i386/libsys/gtty.c | 5 +++ mach/i386/libsys/head_em.s | 62 +++++++++++++++++++++++++++++++++ mach/i386/libsys/ioctl.s | 6 ++++ mach/i386/libsys/kill.s | 6 ++++ mach/i386/libsys/link.s | 6 ++++ mach/i386/libsys/lseek.s | 6 ++++ mach/i386/libsys/mknod.s | 6 ++++ mach/i386/libsys/mount.s | 6 ++++ mach/i386/libsys/nice.s | 6 ++++ mach/i386/libsys/open.s | 6 ++++ mach/i386/libsys/pause.s | 6 ++++ mach/i386/libsys/pipe.c | 14 ++++++++ mach/i386/libsys/profil.c | 6 ++++ mach/i386/libsys/read.s | 6 ++++ mach/i386/libsys/sbrk.s | 29 ++++++++++++++++ mach/i386/libsys/setgid.s | 6 ++++ mach/i386/libsys/setuid.s | 6 ++++ mach/i386/libsys/signal.s | 38 ++++++++++++++++++++ mach/i386/libsys/stat.s | 6 ++++ mach/i386/libsys/stime.c | 5 +++ mach/i386/libsys/stty.c | 5 +++ mach/i386/libsys/sync.s | 6 ++++ mach/i386/libsys/sys.s | 23 +++++++++++++ mach/i386/libsys/time.c | 11 ++++++ mach/i386/libsys/times.s | 6 ++++ mach/i386/libsys/ulimit.s | 6 ++++ mach/i386/libsys/umask.s | 6 ++++ mach/i386/libsys/umount.s | 6 ++++ mach/i386/libsys/uname.s | 6 ++++ mach/i386/libsys/unlink.s | 6 ++++ mach/i386/libsys/utime.s | 6 ++++ mach/i386/libsys/wait.c | 11 ++++++ mach/i386/libsys/write.s | 6 ++++ mach/i386/libsys/xdup.s | 6 ++++ 74 files changed, 719 insertions(+) create mode 100644 mach/i386/libsys/.distr create mode 100644 mach/i386/libsys/LIST create mode 100644 mach/i386/libsys/Makefile create mode 100644 mach/i386/libsys/TODO create mode 100644 mach/i386/libsys/_exit.s create mode 100644 mach/i386/libsys/_pipe.s create mode 100644 mach/i386/libsys/_profil.s create mode 100644 mach/i386/libsys/_stime.s create mode 100644 mach/i386/libsys/_time.s create mode 100644 mach/i386/libsys/_wait.s create mode 100644 mach/i386/libsys/access.s create mode 100644 mach/i386/libsys/acct.s create mode 100644 mach/i386/libsys/alarm.s create mode 100644 mach/i386/libsys/brk.s create mode 100644 mach/i386/libsys/chdir.s create mode 100644 mach/i386/libsys/chmod.s create mode 100644 mach/i386/libsys/chown.s create mode 100644 mach/i386/libsys/chroot.s create mode 100644 mach/i386/libsys/cleanup.c create mode 100644 mach/i386/libsys/close.s create mode 100755 mach/i386/libsys/compmodule create mode 100644 mach/i386/libsys/creat.s create mode 100644 mach/i386/libsys/dup.c create mode 100644 mach/i386/libsys/dup2.c create mode 100644 mach/i386/libsys/execl.c create mode 100644 mach/i386/libsys/execle.c create mode 100644 mach/i386/libsys/execv.c create mode 100644 mach/i386/libsys/execve.s create mode 100644 mach/i386/libsys/exit.c create mode 100644 mach/i386/libsys/fcntl.s create mode 100644 mach/i386/libsys/fork.s create mode 100644 mach/i386/libsys/fstat.s create mode 100644 mach/i386/libsys/ftime.s create mode 100644 mach/i386/libsys/getegid.s create mode 100644 mach/i386/libsys/geteuid.s create mode 100644 mach/i386/libsys/getgid.s create mode 100644 mach/i386/libsys/getpgrp.s create mode 100644 mach/i386/libsys/getpid.s create mode 100644 mach/i386/libsys/getppid.s create mode 100644 mach/i386/libsys/getuid.s create mode 100644 mach/i386/libsys/gtty.c create mode 100644 mach/i386/libsys/head_em.s create mode 100644 mach/i386/libsys/ioctl.s create mode 100644 mach/i386/libsys/kill.s create mode 100644 mach/i386/libsys/link.s create mode 100644 mach/i386/libsys/lseek.s create mode 100644 mach/i386/libsys/mknod.s create mode 100644 mach/i386/libsys/mount.s create mode 100644 mach/i386/libsys/nice.s create mode 100644 mach/i386/libsys/open.s create mode 100644 mach/i386/libsys/pause.s create mode 100644 mach/i386/libsys/pipe.c create mode 100644 mach/i386/libsys/profil.c create mode 100644 mach/i386/libsys/read.s create mode 100644 mach/i386/libsys/sbrk.s create mode 100644 mach/i386/libsys/setgid.s create mode 100644 mach/i386/libsys/setuid.s create mode 100644 mach/i386/libsys/signal.s create mode 100644 mach/i386/libsys/stat.s create mode 100644 mach/i386/libsys/stime.c create mode 100644 mach/i386/libsys/stty.c create mode 100644 mach/i386/libsys/sync.s create mode 100644 mach/i386/libsys/sys.s create mode 100644 mach/i386/libsys/time.c create mode 100644 mach/i386/libsys/times.s create mode 100644 mach/i386/libsys/ulimit.s create mode 100644 mach/i386/libsys/umask.s create mode 100644 mach/i386/libsys/umount.s create mode 100644 mach/i386/libsys/uname.s create mode 100644 mach/i386/libsys/unlink.s create mode 100644 mach/i386/libsys/utime.s create mode 100644 mach/i386/libsys/wait.c create mode 100644 mach/i386/libsys/write.s create mode 100644 mach/i386/libsys/xdup.s diff --git a/mach/i386/libsys/.distr b/mach/i386/libsys/.distr new file mode 100644 index 000000000..d5a561d2c --- /dev/null +++ b/mach/i386/libsys/.distr @@ -0,0 +1,5 @@ +LIST +Makefile +compmodule +head_em.s +libmon_s.a diff --git a/mach/i386/libsys/LIST b/mach/i386/libsys/LIST new file mode 100644 index 000000000..0a9b5dc39 --- /dev/null +++ b/mach/i386/libsys/LIST @@ -0,0 +1,69 @@ +libmon_s.a +exit.c +cleanup.c +stty.c +gtty.c +dup.c +dup2.c +execl.c +execle.c +execv.c +pipe.c +profil.c +stime.c +time.c +wait.c +_exit.s +_pipe.s +_profil.s +_stime.s +_time.s +_wait.s +access.s +acct.s +alarm.s +brk.s +chdir.s +chmod.s +chown.s +chroot.s +close.s +creat.s +execve.s +fcntl.s +fork.s +fstat.s +ftime.s +getegid.s +geteuid.s +getgid.s +getpgrp.s +getpid.s +getppid.s +getuid.s +ioctl.s +kill.s +link.s +lseek.s +mknod.s +mount.s +nice.s +open.s +pause.s +read.s +sbrk.s +setgid.s +setuid.s +signal.s +stat.s +sync.s +sys.s +times.s +ulimit.s +umask.s +umount.s +uname.s +unlink.s +utime.s +write.s +xdup.s diff --git a/mach/i386/libsys/Makefile b/mach/i386/libsys/Makefile new file mode 100644 index 000000000..d00169f2d --- /dev/null +++ b/mach/i386/libsys/Makefile @@ -0,0 +1,28 @@ +# $Header$ +MACH=i386 +all: libmon_o.a head_em.o + +install: all + ../../install libmon_o.a tail_mon + ../../install head_em.o head_em + +cmp: all + -../../compare libmon_o.a tail_mon + -../../compare head_em.o head_em + +libmon_o.a: libmon_s.a + ASAR=aal ; export ASAR ;\ + march . libmon_o.a + +head_em.o: head_em.s + $(MACH) -O -c head_em.s + +clean: + rm -f *.o libmon_o.a + +opr : + make pr | opr + +pr: + @pr `pwd`/head_em.s + @arch pv libmon_s.a | pr -h `pwd`/libmon_s.a diff --git a/mach/i386/libsys/TODO b/mach/i386/libsys/TODO new file mode 100644 index 000000000..8ddc880c5 --- /dev/null +++ b/mach/i386/libsys/TODO @@ -0,0 +1,2 @@ +This library is incomplete. Of some Xenix systemcalls the interface is +not implemented. diff --git a/mach/i386/libsys/_exit.s b/mach/i386/libsys/_exit.s new file mode 100644 index 000000000..445d1e25c --- /dev/null +++ b/mach/i386/libsys/_exit.s @@ -0,0 +1,7 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define __exit +.sect .text +__exit: + mov ax,1 + callf 0x7:0x0 + jmp cerror diff --git a/mach/i386/libsys/_pipe.s b/mach/i386/libsys/_pipe.s new file mode 100644 index 000000000..a51103290 --- /dev/null +++ b/mach/i386/libsys/_pipe.s @@ -0,0 +1,12 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define __pipe +.sect .text +__pipe: + mov ax,42 + callf 0x7:0x0 + jae 1f + jmp cerror +1: + shl dx,0x10 + or eax,edx + ret diff --git a/mach/i386/libsys/_profil.s b/mach/i386/libsys/_profil.s new file mode 100644 index 000000000..53ce0879d --- /dev/null +++ b/mach/i386/libsys/_profil.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define __profil +.sect .text +__profil: + mov ax,44 + jmp syscal diff --git a/mach/i386/libsys/_stime.s b/mach/i386/libsys/_stime.s new file mode 100644 index 000000000..5b8aa68e7 --- /dev/null +++ b/mach/i386/libsys/_stime.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define __stime +.sect .text +__stime: + mov ax,25 + jmp sysx diff --git a/mach/i386/libsys/_time.s b/mach/i386/libsys/_time.s new file mode 100644 index 000000000..9e71c45be --- /dev/null +++ b/mach/i386/libsys/_time.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define __time +.sect .text +__time: + mov ax,13 + jmp syscal diff --git a/mach/i386/libsys/_wait.s b/mach/i386/libsys/_wait.s new file mode 100644 index 000000000..045f50e6a --- /dev/null +++ b/mach/i386/libsys/_wait.s @@ -0,0 +1,12 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define __wait +.sect .text +__wait: + mov ax,7 + callf 0x7:0x0 + jb 1f + shl dx,0x10 + or eax,edx + ret +1: + jmp cerror diff --git a/mach/i386/libsys/access.s b/mach/i386/libsys/access.s new file mode 100644 index 000000000..2ada3bb47 --- /dev/null +++ b/mach/i386/libsys/access.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _access +.sect .text +_access: + mov ax,33 + jmp sysx diff --git a/mach/i386/libsys/acct.s b/mach/i386/libsys/acct.s new file mode 100644 index 000000000..17a698d64 --- /dev/null +++ b/mach/i386/libsys/acct.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _acct +.sect .text +_acct: + mov ax,51 + jmp sysx diff --git a/mach/i386/libsys/alarm.s b/mach/i386/libsys/alarm.s new file mode 100644 index 000000000..e826ee499 --- /dev/null +++ b/mach/i386/libsys/alarm.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _alarm +.sect .text +_alarm: + mov ax,27 + jmp syscal diff --git a/mach/i386/libsys/brk.s b/mach/i386/libsys/brk.s new file mode 100644 index 000000000..7933cd414 --- /dev/null +++ b/mach/i386/libsys/brk.s @@ -0,0 +1,13 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _brk +.sect .text +_brk: + mov ax,17 + callf 0x7:0x0 + jb 1f + mov ax,4(sp) + mov (.limhp),ax + xor ax,ax + ret +1: + jmp cerror diff --git a/mach/i386/libsys/chdir.s b/mach/i386/libsys/chdir.s new file mode 100644 index 000000000..410245e5e --- /dev/null +++ b/mach/i386/libsys/chdir.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _chdir +.sect .text +_chdir: + mov ax,12 + jmp sysx diff --git a/mach/i386/libsys/chmod.s b/mach/i386/libsys/chmod.s new file mode 100644 index 000000000..ecc11ba3c --- /dev/null +++ b/mach/i386/libsys/chmod.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _chmod +.sect .text +_chmod: + mov ax,15 + jmp sysx diff --git a/mach/i386/libsys/chown.s b/mach/i386/libsys/chown.s new file mode 100644 index 000000000..6aa5d1244 --- /dev/null +++ b/mach/i386/libsys/chown.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _chown +.sect .text +_chown: + mov ax,16 + jmp sysx diff --git a/mach/i386/libsys/chroot.s b/mach/i386/libsys/chroot.s new file mode 100644 index 000000000..dad13127d --- /dev/null +++ b/mach/i386/libsys/chroot.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _chroot +.sect .text +_chroot: + mov ax,61 + jmp sysx diff --git a/mach/i386/libsys/cleanup.c b/mach/i386/libsys/cleanup.c new file mode 100644 index 000000000..6cd9c63e6 --- /dev/null +++ b/mach/i386/libsys/cleanup.c @@ -0,0 +1 @@ +_cleanup() { } diff --git a/mach/i386/libsys/close.s b/mach/i386/libsys/close.s new file mode 100644 index 000000000..e81f5d1fe --- /dev/null +++ b/mach/i386/libsys/close.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _close +.sect .text +_close: + mov ax,6 + jmp sysx diff --git a/mach/i386/libsys/compmodule b/mach/i386/libsys/compmodule new file mode 100755 index 000000000..db47c6103 --- /dev/null +++ b/mach/i386/libsys/compmodule @@ -0,0 +1,4 @@ +if i386 -c -L $1 1>&2 +then echo `basename $1 $2`.o +else exit 1 +fi diff --git a/mach/i386/libsys/creat.s b/mach/i386/libsys/creat.s new file mode 100644 index 000000000..6d389830e --- /dev/null +++ b/mach/i386/libsys/creat.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _creat +.sect .text +_creat: + mov ax,8 + jmp syscal diff --git a/mach/i386/libsys/dup.c b/mach/i386/libsys/dup.c new file mode 100644 index 000000000..a1dfc2a9f --- /dev/null +++ b/mach/i386/libsys/dup.c @@ -0,0 +1,5 @@ +int +dup(d) +{ + return __xdup(d, 0); +} diff --git a/mach/i386/libsys/dup2.c b/mach/i386/libsys/dup2.c new file mode 100644 index 000000000..ba0513b87 --- /dev/null +++ b/mach/i386/libsys/dup2.c @@ -0,0 +1,6 @@ +int +dup2(oldd, newd) +{ + oldd |= 64; + return __xdup(oldd, newd); +} diff --git a/mach/i386/libsys/execl.c b/mach/i386/libsys/execl.c new file mode 100644 index 000000000..6fdcea3a3 --- /dev/null +++ b/mach/i386/libsys/execl.c @@ -0,0 +1,9 @@ +int +execl(name,args) + char *name; + int args; +{ + extern char **environ; + + return execve(name,&args,environ); +} diff --git a/mach/i386/libsys/execle.c b/mach/i386/libsys/execle.c new file mode 100644 index 000000000..6de27d860 --- /dev/null +++ b/mach/i386/libsys/execle.c @@ -0,0 +1,10 @@ +int +execle(name,args) + char *name; + char *args; +{ + char **p = &args; + while (*p++) ; + + return execve(name,&args,*p); +} diff --git a/mach/i386/libsys/execv.c b/mach/i386/libsys/execv.c new file mode 100644 index 000000000..748fec72d --- /dev/null +++ b/mach/i386/libsys/execv.c @@ -0,0 +1,8 @@ +int +execv(name,args) + char *name; + char **args; +{ + extern char **environ; + return execve(name,args,environ); +} diff --git a/mach/i386/libsys/execve.s b/mach/i386/libsys/execve.s new file mode 100644 index 000000000..73b60aeac --- /dev/null +++ b/mach/i386/libsys/execve.s @@ -0,0 +1,7 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _execve +.sect .text +_execve: + mov ax,59 + callf 0x7:0x0 + jmp cerror diff --git a/mach/i386/libsys/exit.c b/mach/i386/libsys/exit.c new file mode 100644 index 000000000..afd54b3f7 --- /dev/null +++ b/mach/i386/libsys/exit.c @@ -0,0 +1,5 @@ +exit(n) +{ + _cleanup(); + _exit(n); +} diff --git a/mach/i386/libsys/fcntl.s b/mach/i386/libsys/fcntl.s new file mode 100644 index 000000000..28cd8219e --- /dev/null +++ b/mach/i386/libsys/fcntl.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _fcntl +.sect .text +_fcntl: + mov ax,62 + jmp syscal diff --git a/mach/i386/libsys/fork.s b/mach/i386/libsys/fork.s new file mode 100644 index 000000000..a685319df --- /dev/null +++ b/mach/i386/libsys/fork.s @@ -0,0 +1,18 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _fork, _par_uid +.sect .bss +.comm _par_uid, 4 +.sect .text +_fork: + mov ax,2 + callf 0x7:0x0 + jb 1f + and dx,dx + jne 2f + ret +1: + jmp cerror +2: + mov (_par_uid),ax + xor ax,ax + ret diff --git a/mach/i386/libsys/fstat.s b/mach/i386/libsys/fstat.s new file mode 100644 index 000000000..97fa8d0bd --- /dev/null +++ b/mach/i386/libsys/fstat.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _fstat +.sect .text +_fstat: + mov ax,28 + jmp sysx diff --git a/mach/i386/libsys/ftime.s b/mach/i386/libsys/ftime.s new file mode 100644 index 000000000..e2c78e236 --- /dev/null +++ b/mach/i386/libsys/ftime.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _ftime +.sect .text +_ftime: + mov ax,2856 + jmp syscal diff --git a/mach/i386/libsys/getegid.s b/mach/i386/libsys/getegid.s new file mode 100644 index 000000000..3225f780f --- /dev/null +++ b/mach/i386/libsys/getegid.s @@ -0,0 +1,11 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _getegid +.sect .text +_getegid: + mov ax,47 + callf 0x7:0x0 + jb 1f + xchg dx,ax + ret +1: + jmp cerror diff --git a/mach/i386/libsys/geteuid.s b/mach/i386/libsys/geteuid.s new file mode 100644 index 000000000..483c6f72a --- /dev/null +++ b/mach/i386/libsys/geteuid.s @@ -0,0 +1,11 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _geteuid +.sect .text +_geteuid: + mov ax,24 + callf 0x7:0x0 + jb 1f + xchg dx,ax + ret +1: + jmp cerror diff --git a/mach/i386/libsys/getgid.s b/mach/i386/libsys/getgid.s new file mode 100644 index 000000000..a218ff2f4 --- /dev/null +++ b/mach/i386/libsys/getgid.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _getgid +.sect .text +_getgid: + mov ax,47 + jmp syscal diff --git a/mach/i386/libsys/getpgrp.s b/mach/i386/libsys/getpgrp.s new file mode 100644 index 000000000..c49f1bd22 --- /dev/null +++ b/mach/i386/libsys/getpgrp.s @@ -0,0 +1,10 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _getpgrp +.sect .text +_getpgrp: + xor ax,ax + push ax + mov ax,39 + call syscal + pop bx + ret diff --git a/mach/i386/libsys/getpid.s b/mach/i386/libsys/getpid.s new file mode 100644 index 000000000..3bf7eec08 --- /dev/null +++ b/mach/i386/libsys/getpid.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _getpid +.sect .text +_getpid: + mov ax,20 + jmp syscal diff --git a/mach/i386/libsys/getppid.s b/mach/i386/libsys/getppid.s new file mode 100644 index 000000000..250ae11fb --- /dev/null +++ b/mach/i386/libsys/getppid.s @@ -0,0 +1,11 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _getppid +.sect .text +_getppid: + mov ax,20 + callf 0x7:0x0 + jb 1f + xchg dx,ax + ret +1: + jmp cerror diff --git a/mach/i386/libsys/getuid.s b/mach/i386/libsys/getuid.s new file mode 100644 index 000000000..f59edd3e0 --- /dev/null +++ b/mach/i386/libsys/getuid.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _getuid +.sect .text +_getuid: + mov ax,24 + jmp syscal diff --git a/mach/i386/libsys/gtty.c b/mach/i386/libsys/gtty.c new file mode 100644 index 000000000..b24c14529 --- /dev/null +++ b/mach/i386/libsys/gtty.c @@ -0,0 +1,5 @@ +gtty(fildes, arg) + char *arg; +{ + return ioctl(fildes, ('t' << 8) | 8, arg); +} diff --git a/mach/i386/libsys/head_em.s b/mach/i386/libsys/head_em.s new file mode 100644 index 000000000..a69785c66 --- /dev/null +++ b/mach/i386/libsys/head_em.s @@ -0,0 +1,62 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss + +.define begtext,begdata,begbss,syscal +.define hol0,.reghp,.limhp,.trppc,.ignmask +.define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ +.extern _end + +ERANGE = 1 +ESET = 2 +EIDIVZ = 6 +EHEAP = 17 +EILLINS = 18 +EODDZ = 19 +ECASE = 20 + +.sect .text + .data1 0353 + .data1 0176 ! jmp to begtext in 2 bytes. Assembler generates 3 + ! bytes. + .data2 -277, -277, -277, -277 + .space 116 + .data2 49920 + +begtext: + mov (.limhp),ax + mov (.reghp),ax + xor bp,bp + mov bx,sp + mov cx,(bx) + add bx,4 + mov ax,cx + inc ax + shl ax,2 + add ax,bx + push ax + push bx + push cx + call _m_a_i_n + push ax + call __exit +.sect .data +begdata: +hol0: + .data2 0,0 + .data2 0,0 +argv: + .data4 3f +envp: + .data4 0 +3: + .asciz "PROGRAM" +.reghp: + .data4 endbss +.limhp: + .data4 endbss +.ignmask: + .data4 0 +.trppc: + .data4 0 + + .sect .bss +begbss: diff --git a/mach/i386/libsys/ioctl.s b/mach/i386/libsys/ioctl.s new file mode 100644 index 000000000..1391669f5 --- /dev/null +++ b/mach/i386/libsys/ioctl.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _ioctl +.sect .text +_ioctl: + mov ax,54 + jmp syscal diff --git a/mach/i386/libsys/kill.s b/mach/i386/libsys/kill.s new file mode 100644 index 000000000..93ee93a3a --- /dev/null +++ b/mach/i386/libsys/kill.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _kill +.sect .text +_kill: + mov ax,37 + jmp sysx diff --git a/mach/i386/libsys/link.s b/mach/i386/libsys/link.s new file mode 100644 index 000000000..838f9091b --- /dev/null +++ b/mach/i386/libsys/link.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _link +.sect .text +_link: + mov ax,9 + jmp sysx diff --git a/mach/i386/libsys/lseek.s b/mach/i386/libsys/lseek.s new file mode 100644 index 000000000..547dc82da --- /dev/null +++ b/mach/i386/libsys/lseek.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _lseek +.sect .text +_lseek: + mov ax,19 + jmp syscal diff --git a/mach/i386/libsys/mknod.s b/mach/i386/libsys/mknod.s new file mode 100644 index 000000000..e7d415d88 --- /dev/null +++ b/mach/i386/libsys/mknod.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _mknod +.sect .text +_mknod: + mov ax,14 + jmp sysx diff --git a/mach/i386/libsys/mount.s b/mach/i386/libsys/mount.s new file mode 100644 index 000000000..71ecc44f6 --- /dev/null +++ b/mach/i386/libsys/mount.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _mount +.sect .text +_mount: + mov ax,21 + jmp sysx diff --git a/mach/i386/libsys/nice.s b/mach/i386/libsys/nice.s new file mode 100644 index 000000000..32dea5f6a --- /dev/null +++ b/mach/i386/libsys/nice.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _nice +.sect .text +_nice: + mov ax,34 + jmp syscal diff --git a/mach/i386/libsys/open.s b/mach/i386/libsys/open.s new file mode 100644 index 000000000..7fa7b1bb0 --- /dev/null +++ b/mach/i386/libsys/open.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _open +.sect .text +_open: + mov ax,5 + jmp syscal diff --git a/mach/i386/libsys/pause.s b/mach/i386/libsys/pause.s new file mode 100644 index 000000000..d81d7cac3 --- /dev/null +++ b/mach/i386/libsys/pause.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _pause +.sect .text +_pause: + mov ax,29 + jmp syscal diff --git a/mach/i386/libsys/pipe.c b/mach/i386/libsys/pipe.c new file mode 100644 index 000000000..fa38108f9 --- /dev/null +++ b/mach/i386/libsys/pipe.c @@ -0,0 +1,14 @@ +long _pipe(); + +int +pipe(f) + int f[2]; +{ + long x; + + x = _pipe(); + if (x == -1) return -1; + f[0] = x; + f[1] = x >> 16; + return 0; +} diff --git a/mach/i386/libsys/profil.c b/mach/i386/libsys/profil.c new file mode 100644 index 000000000..f20e10c47 --- /dev/null +++ b/mach/i386/libsys/profil.c @@ -0,0 +1,6 @@ +profil(buff, bufsiz, offset, scale) + char *buff; + int (*offset)(); +{ + _profil(buff, bufsiz, offset, scale, 7262); +} diff --git a/mach/i386/libsys/read.s b/mach/i386/libsys/read.s new file mode 100644 index 000000000..fd529e88a --- /dev/null +++ b/mach/i386/libsys/read.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _read +.sect .text +_read: + mov ax,3 + jmp syscal diff --git a/mach/i386/libsys/sbrk.s b/mach/i386/libsys/sbrk.s new file mode 100644 index 000000000..cccd151d1 --- /dev/null +++ b/mach/i386/libsys/sbrk.s @@ -0,0 +1,29 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _sbrk +.sect .text +_sbrk: + push bp + mov bp,sp + mov ax,8(bp) + or ax,ax + jne 1f + mov ax,(.limhp) + pop bp + ret +1: + mov bx,(.limhp) + add ax,bx + push ax + call _brk + or ax,ax + jne 1f + pop ax + mov (.limhp),ax + mov ax,bx + pop bp + ret +1: + pop ax + mov ax,-1 + pop bp + ret diff --git a/mach/i386/libsys/setgid.s b/mach/i386/libsys/setgid.s new file mode 100644 index 000000000..4ca72f943 --- /dev/null +++ b/mach/i386/libsys/setgid.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _setgid +.sect .text +_setgid: + mov ax,46 + jmp sysx diff --git a/mach/i386/libsys/setuid.s b/mach/i386/libsys/setuid.s new file mode 100644 index 000000000..698143efa --- /dev/null +++ b/mach/i386/libsys/setuid.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _setuid +.sect .text +_setuid: + mov ax,23 + jmp sysx diff --git a/mach/i386/libsys/signal.s b/mach/i386/libsys/signal.s new file mode 100644 index 000000000..66ac58f62 --- /dev/null +++ b/mach/i386/libsys/signal.s @@ -0,0 +1,38 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _signal +.sect .text +_signal: + call sig1 + mov ax,48 + mov dx,ctch + callf 0x7:0x0 + jb 4f + ret +sig1: + mov ax,8(sp) + cmp ax,20 + jae 1f + mov dx,table(ax*4) + mov (prev),dx + mov dx,12(sp) + mov table(ax*4),dx + ret +1: + pop ax + mov ax,0x16 +4: + mov (_errno),ax + mov ax,-1 + cdq + ret + +ctch: + add sp,4 + callf 0xf:0x0 + +.sect .bss +table: + .space 40 +prev: + .space 4 + diff --git a/mach/i386/libsys/stat.s b/mach/i386/libsys/stat.s new file mode 100644 index 000000000..315a61a5d --- /dev/null +++ b/mach/i386/libsys/stat.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _stat +.sect .text +_stat: + mov ax,18 + jmp sysx diff --git a/mach/i386/libsys/stime.c b/mach/i386/libsys/stime.c new file mode 100644 index 000000000..ce0313064 --- /dev/null +++ b/mach/i386/libsys/stime.c @@ -0,0 +1,5 @@ +stime(p) + long *p; +{ + return _stime(*p); +} diff --git a/mach/i386/libsys/stty.c b/mach/i386/libsys/stty.c new file mode 100644 index 000000000..84d37ccab --- /dev/null +++ b/mach/i386/libsys/stty.c @@ -0,0 +1,5 @@ +stty(fildes, arg) + char *arg; +{ + return ioctl(fildes, ('t' << 8) | 9, arg); +} diff --git a/mach/i386/libsys/sync.s b/mach/i386/libsys/sync.s new file mode 100644 index 000000000..6d03a84b7 --- /dev/null +++ b/mach/i386/libsys/sync.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _sync +.sect .text +_sync: + mov ax,36 + jmp syscal diff --git a/mach/i386/libsys/sys.s b/mach/i386/libsys/sys.s new file mode 100644 index 000000000..167b0370b --- /dev/null +++ b/mach/i386/libsys/sys.s @@ -0,0 +1,23 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define sysx, syscal, cerror, _errno + +.sect .bss + .comm _errno, 4 + +.sect .text + +syscal: + callf 0x7:0x0 + jb cerror + ret + +sysx: + callf 0x7:0x0 + jb cerror + xor ax,ax + ret +cerror: + mov (_errno),ax + mov ax,-1 + ret + diff --git a/mach/i386/libsys/time.c b/mach/i386/libsys/time.c new file mode 100644 index 000000000..600b94143 --- /dev/null +++ b/mach/i386/libsys/time.c @@ -0,0 +1,11 @@ +long _time(); + +long +time(p) + long *p; +{ + long l = _time(); + if (p) *p = l; + + return l; +} diff --git a/mach/i386/libsys/times.s b/mach/i386/libsys/times.s new file mode 100644 index 000000000..9500cd3d6 --- /dev/null +++ b/mach/i386/libsys/times.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _times +.sect .text +_times: + mov ax,43 + jmp syscal diff --git a/mach/i386/libsys/ulimit.s b/mach/i386/libsys/ulimit.s new file mode 100644 index 000000000..7de69a742 --- /dev/null +++ b/mach/i386/libsys/ulimit.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _ulimit +.sect .text +_ulimit: + mov ax,63 + jmp syscal diff --git a/mach/i386/libsys/umask.s b/mach/i386/libsys/umask.s new file mode 100644 index 000000000..b1103ecf5 --- /dev/null +++ b/mach/i386/libsys/umask.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _umask +.sect .text +_umask: + mov ax,60 + jmp syscal diff --git a/mach/i386/libsys/umount.s b/mach/i386/libsys/umount.s new file mode 100644 index 000000000..37c34e15a --- /dev/null +++ b/mach/i386/libsys/umount.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _umount +.sect .text +_umount: + mov ax,22 + jmp sysx diff --git a/mach/i386/libsys/uname.s b/mach/i386/libsys/uname.s new file mode 100644 index 000000000..0ebeca426 --- /dev/null +++ b/mach/i386/libsys/uname.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _uname +.sect .text +_uname: + mov ax,57 + jmp syscal diff --git a/mach/i386/libsys/unlink.s b/mach/i386/libsys/unlink.s new file mode 100644 index 000000000..5c7122266 --- /dev/null +++ b/mach/i386/libsys/unlink.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _unlink +.sect .text +_unlink: + mov ax,10 + jmp sysx diff --git a/mach/i386/libsys/utime.s b/mach/i386/libsys/utime.s new file mode 100644 index 000000000..4c68d1bac --- /dev/null +++ b/mach/i386/libsys/utime.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _utime +.sect .text +_utime: + mov ax,30 + jmp sysx diff --git a/mach/i386/libsys/wait.c b/mach/i386/libsys/wait.c new file mode 100644 index 000000000..d8d01d758 --- /dev/null +++ b/mach/i386/libsys/wait.c @@ -0,0 +1,11 @@ +long _wait(); + +wait(p) + int *p; +{ + long l = _wait(); + + if (l == -1) return -1; + if (p) *p = (l >> 16); + return l & 0xffff; +} diff --git a/mach/i386/libsys/write.s b/mach/i386/libsys/write.s new file mode 100644 index 000000000..4a495555a --- /dev/null +++ b/mach/i386/libsys/write.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define _write +.sect .text +_write: + mov ax,4 + jmp syscal diff --git a/mach/i386/libsys/xdup.s b/mach/i386/libsys/xdup.s new file mode 100644 index 000000000..12d4488b7 --- /dev/null +++ b/mach/i386/libsys/xdup.s @@ -0,0 +1,6 @@ +.sect .text; .sect .rom; .sect .data; .sect .bss +.define ___xdup +.sect .text +___xdup: + mov ax,41 + jmp syscal