--- /dev/null
+libmon_s.a
+accept.s
+access.s
+acct.s
+adjtime.s
+alarm.c
+async_dem.s
+bind.s
+cerror.s
+chdir.s
+chmod.s
+chown.s
+chroot.s
+cleanup.c
+close.s
+connect.s
+creat.s
+dup.s
+dup2.s
+execl.c
+execle.c
+execv.c
+execve.s
+exit.c
+exportfs.s
+fchmod.s
+fchown.s
+fcntl.s
+flock.s
+fork.s
+fstat.s
+fstatfs.s
+fsync.s
+ftime.c
+ftruncate.s
+getdirent.s
+getdomnam.s
+getdopt.s
+getdtabsz.s
+getfh.s
+getgid.s
+getgroups.s
+gethostid.s
+gethostnam.s
+getitimer.s
+getpagesiz.s
+getpeernam.s
+getpgrp.s
+getpid.s
+getprio.s
+getrlimit.s
+getrusage.s
+getsocknam.s
+getsockopt.s
+gettimday.s
+getuid.s
+ioctl.s
+kill.s
+killpg.s
+link.s
+listen.s
+lseek.s
+lstat.s
+madvise.s
+mincore.s
+mkdir.s
+mknod.s
+mmap.s
+mount.s
+mprotect.s
+mremap.s
+munmap.s
+nfssvc.s
+nice.c
+open.s
+pause.c
+pipe.s
+profil.s
+ptrace.s
+quotactl.s
+read.s
+readlink.s
+readv.s
+reboot.s
+recv.s
+recvfrom.s
+recvmsg.s
+rename.s
+rmdir.s
+sbrk.s
+select.s
+send.s
+sendmsg.s
+sendto.s
+setdomnam.s
+setdopt.s
+setgroups.s
+sethostnam.s
+setitimer.s
+setpgrp.s
+setprio.s
+setregid.s
+setreuid.s
+setrlimit.s
+setsockopt.s
+settimday.s
+shutdown.s
+sigblock.s
+signal.c
+sigpause.s
+sigsetmask.s
+sigstack.s
+sigtramp.s
+sigvec.c
+socket.s
+socketpair.s
+sstk.s
+stat.s
+statfs.s
+swapon.s
+symlink.s
+sync.s
+syscall.s
+time.c
+times.c
+truncate.s
+umask.s
+unlink.s
+unmount.s
+utime.c
+utimes.s
+vhangup.s
+wait.s
+write.s
+writev.s
+_exit.s
+stty.c
+gtty.c
+getegid.s
+geteuid.s
+getppid.s
+lockf.c
+setgid.c
+setuid.c
+stime.c
+tell.c
+ulimit.c
+vadvise.s
+vfork.s
+wait3.s
--- /dev/null
+# $Header$
+MACH=sun2
+all: libmon_o.a head_em.o
+
+install: all
+ ../../install head_em.o head_em
+ ../../install libmon_o.a tail_mon
+
+
+cmp: all
+ -../../compare head_em.o head_em
+ -../../compare libmon_o.a tail_mon
+
+libmon_o.a: libmon_s.a
+ ASAR=aal ; export ASAR ;\
+ march . libmon_o.a
+
+head_em.o: head_em.s
+ $(MACH) -I../../../h -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
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define __exit
+__exit:
+ pea SYS_exit
+ trap #0
+ jmp cerror
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _accept
+_accept: SYSTEM(SYS_accept)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _access
+_access: SYSTEM(SYS_access)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _acct
+_acct: SYSTEM(SYS_acct)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _adjtime
+_adjtime: SYSTEM(SYS_adjtime)
--- /dev/null
+unsigned
+alarm(n)
+ unsigned n;
+{
+ struct { long l1,l2,l3,l4; } t1,t2;
+ t1.l1 = 0;
+ t1.l2 = 0;
+ t1.l4 = 0;
+ t1.l3 = n;
+ if (setitimer(0,&t1,&t2) < 0) return -1;
+ if (t2.l4) t2.l3++;
+ return t2.l3;
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _async_daemon
+_async_daemon: SYSTEM(SYS_async_daemon)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _bind
+_bind: SYSTEM(SYS_bind)
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define cerror,_errno
+cerror:
+ move.l d0,_errno
+ move.l #-1,d0
+ rts
+
+.sect .bss
+_errno: .space 4
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _chdir
+_chdir: SYSTEM(SYS_chdir)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _chmod
+_chmod: SYSTEM(SYS_chmod)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _chown
+_chown: SYSTEM(SYS_chown)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _chroot
+_chroot: SYSTEM(SYS_chroot)
--- /dev/null
+_cleanup() { }
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _close
+_close: SYSTEM(SYS_close)
--- /dev/null
+if sun2 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _connect
+_connect: SYSTEM(SYS_connect)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _creat
+_creat: SYSTEM(SYS_creat)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _dup
+_dup: SYSTEM(SYS_dup)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _dup2
+_dup2: SYSTEM(SYS_dup2)
--- /dev/null
+execl(name,args)
+ char *name;
+ int args;
+{
+ extern char **environ;
+
+ execve(name,&args,environ);
+}
--- /dev/null
+execle(name,args)
+ char *name;
+ char *args;
+{
+ char **p = &args;
+ while (*p++) ;
+
+ execve(name,&args,*p);
+}
--- /dev/null
+execv(name,args)
+ char *name;
+ char **args;
+{
+ extern char **environ;
+ execve(name,args,environ);
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _execve
+_execve: SYSTEM(SYS_execve)
--- /dev/null
+exit(n)
+{
+ _cleanup();
+ _exit(n);
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _exportfs
+_exportfs: SYSTEM(SYS_exportfs)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fchmod
+_fchmod: SYSTEM(SYS_fchmod)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fchown
+_fchown: SYSTEM(SYS_fchown)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fcntl
+_fcntl: SYSTEM(SYS_fcntl)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _flock
+_flock: SYSTEM(SYS_flock)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fork
+_fork:
+ pea SYS_fork
+ trap #0
+ bcs 1f
+ tst.l d1
+ beq 2f
+ clr.l d0
+2:
+ rts
+1:
+ jmp cerror
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fstat
+_fstat: SYSTEM(SYS_fstat)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fstatfs
+_fstatfs: SYSTEM(SYS_fstatfs)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fsync
+_fsync: SYSTEM(SYS_fsync)
--- /dev/null
+#include <sys/types.h>
+
+ftime(p)
+ struct { time_t time; unsigned short millitm;
+ short timezone; short dstflag; } *p;
+{
+ struct { long l1,l2; } t1,t2;
+
+ if (gettimeofday(&t1,&t2) < 0) return -1;
+ p->time = t1.l1;
+ p->millitm = t1.l2/1000;
+ p->dstflag = t2.l2;
+ p->timezone = t2.l1;
+ return 0;
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _ftruncate
+_ftruncate: SYSTEM(SYS_ftruncate)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getdirentries
+_getdirentries: SYSTEM(SYS_getdirentries)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getdomainname
+_getdomainname: SYSTEM(SYS_getdomainname)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getdopt
+_getdopt: SYSTEM(SYS_getdopt)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getdtablesize
+_getdtablesize: SYSTEM(SYS_getdtablesize)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getegid
+_getegid:
+ pea SYS_getgid
+ trap #0
+ move.l d1,d0
+ rts
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _geteuid
+_geteuid:
+ pea SYS_getuid
+ trap #0
+ move.l d1,d0
+ rts
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getfh
+_getfh: SYSTEM(SYS_getfh)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getgid
+_getgid: SYSTEM(SYS_getgid)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getgroups
+_getgroups: SYSTEM(SYS_getgroups)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _gethostid
+_gethostid: SYSTEM(SYS_gethostid)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _gethostname
+_gethostname: SYSTEM(SYS_gethostname)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getitimer
+_getitimer: SYSTEM(SYS_getitimer)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpagesize
+_getpagesize: SYSTEM(SYS_getpagesize)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpeername
+_getpeername: SYSTEM(SYS_getpeername)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpgrp
+_getpgrp: SYSTEM(SYS_getpgrp)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpid
+_getpid: SYSTEM(SYS_getpid)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getppid
+_getppid:
+ pea SYS_getpid
+ trap #0
+ move.l d1,d0
+ rts
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpriority
+_getpriority: SYSTEM(SYS_getpriority)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getrlimit
+_getrlimit: SYSTEM(SYS_getrlimit)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getrusage
+_getrusage: SYSTEM(SYS_getrusage)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getsockname
+_getsockname: SYSTEM(SYS_getsockname)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getsockopt
+_getsockopt: SYSTEM(SYS_getsockopt)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _gettimeofday
+_gettimeofday: SYSTEM(SYS_gettimeofday)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getuid
+_getuid: SYSTEM(SYS_getuid)
--- /dev/null
+#include <sgtty.h>
+int gtty(fildes,argp)
+ int fildes ;
+ struct sgttyb *argp ;
+{
+ return ioctl(fildes,TIOCGETP,argp) ;
+}
--- /dev/null
+.define .lino,.filn
+.define EXIT
+.define begtext,begdata,begbss
+.define EARRAY,ERANGE,ESET,EIDIVZ,EHEAP,EILLINS,ECASE,EBADGTO
+.define hol0,.reghp,.limhp,.trpim,.trppc
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+
+
+! runtime startof for 68020 machine
+
+
+LINO_AD = 0
+FILN_AD = 4
+
+EARRAY = 0
+ERANGE = 1
+ESET = 2
+EIDIVZ = 6
+EHEAP = 17
+EILLINS = 18
+ECASE = 20
+EBADGTO = 27
+
+ .sect .text
+begtext:
+ move.l (sp),d2
+ lea 4(sp),a0
+ move.l d2,d1
+ add.l #1,d1
+ asl.l #2,d1
+ move.l a0,a1
+ add.l d1,a1
+ pea (a1)
+ pea (a0)
+ move.l d2,-(sp)
+ move.l #0,a6
+ jsr _m_a_i_n
+ move.l d0,(sp) ! no stack cleanup needed
+EXIT:
+ jsr _exit
+
+ .sect .data
+begdata:
+ .data4 0 ! may be at virtual address 0 with no problem
+hol0:
+.lino:
+ .data4 0 ! lino
+.filn:
+ .data4 0 ! filn
+.reghp:
+ .data4 endbss
+.limhp:
+ .data4 endbss
+.trppc:
+ .data4 0
+.trpim:
+ .data4 0 ! USED TO BE 2 BYTES; IS THIS RIGHT?
+
+
+ .sect .bss
+begbss: !initialization is not needed because ALL entries are in zero space!
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _ioctl
+_ioctl: SYSTEM(SYS_ioctl)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _kill
+_kill: SYSTEM(SYS_kill)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _killpg
+_killpg: SYSTEM(SYS_killpg)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _link
+_link: SYSTEM(SYS_link)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _listen
+_listen: SYSTEM(SYS_listen)
--- /dev/null
+#include <errno.h>
+lockf(fildes, mode, size)
+ long size;
+{
+ struct {
+ short type, whence; long start, end; short pid;
+ } x;
+ int i = 8;
+ extern int errno;
+
+ x.type = 2;
+ x.whence = 1;
+ x.start = 0;
+ x.end = size;
+ switch(mode) {
+ case 0:
+ x.type = 3;
+ break;
+ case 1:
+ i = 9;
+ break;
+ case 2:
+ break;
+ case 3:
+ if (fcntl(fildes,7,&x) == -1) {
+ return -1;
+ }
+ if (x.type == 3) {
+ return 0;
+ }
+ errno = EACCES;
+ return -1;
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+ if (fcntl(fildes,i,&x) == -1) {
+ if (errno = 79) {
+ errno = 78;
+ }
+ return -1;
+ }
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _lseek
+_lseek: SYSTEM(SYS_lseek)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _lstat
+_lstat: SYSTEM(SYS_lstat)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _madvise
+_madvise: SYSTEM(SYS_madvise)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mincore
+_mincore: SYSTEM(SYS_mincore)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mkdir
+_mkdir: SYSTEM(SYS_mkdir)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mknod
+_mknod: SYSTEM(SYS_mknod)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mmap
+_mmap: SYSTEM(SYS_mmap)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mount
+_mount: SYSTEM(SYS_mount)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mprotect
+_mprotect: SYSTEM(SYS_mprotect)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mremap
+_mremap: SYSTEM(SYS_mremap)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _munmap
+_munmap: SYSTEM(SYS_munmap)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _nfssvc
+_nfssvc: SYSTEM(SYS_nfssvc)
--- /dev/null
+nice(incr)
+{
+ extern int errno;
+ int sav = errno;
+ int prio;
+
+ errno = 0;
+ prio = getpriority(0,0);
+ if (prio == -1 && errno) return -1;
+ if (setpriority(0,0,prio+incr) < 0) return -1;
+ errno = sav;
+ return 0;
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _open
+_open: SYSTEM(SYS_open)
--- /dev/null
+pause() {
+ sigpause(sigblock());
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _pipe
+_pipe:
+ pea SYS_pipe
+ trap #0
+ bcs 1f
+ move.l 4(sp),a0
+ move.l d0,(a0)+
+ move.l d1,(a0)
+ clr.l d0
+ rts
+1:
+ jmp cerror
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _profil
+_profil: SYSTEM(SYS_profil)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _ptrace
+.extern _errno
+_ptrace:
+ clr.l _errno
+ SYSTEM(SYS_ptrace)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _quotactl
+_quotactl: SYSTEM(SYS_quotactl)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _read
+_read: SYSTEM(SYS_read)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _readlink
+_readlink: SYSTEM(SYS_readlink)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _readv
+_readv: SYSTEM(SYS_readv)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _reboot
+_reboot:
+ pea SYS_reboot
+ trap #0
+ bcs 1f
+ stop #0
+1:
+ jmp cerror
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _recv
+_recv: SYSTEM(SYS_recv)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _recvfrom
+_recvfrom: SYSTEM(SYS_recvfrom)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _recvmsg
+_recvmsg: SYSTEM(SYS_recvmsg)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _rename
+_rename: SYSTEM(SYS_rename)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _rmdir
+_rmdir: SYSTEM(SYS_rmdir)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sbrk,_brk
+_sbrk:
+ move.l 4(sp),d0
+ add.l #3,d0
+ move.l #~3,d1
+ and.l d1,d0
+ move.l d0,a0
+ move.l curbrk,d0
+ add.l #3,d0
+ and.l d1,d0
+ move.l d0,curbrk
+ add.l d0,a0
+ move.l a0,4(sp)
+ pea 17 ! not SYS_sbrk
+ trap #0
+ bcs 1f
+ move.l curbrk,d0
+ move.l 4(sp),curbrk
+ rts
+1:
+ jmp cerror
+
+_brk:
+ move.l 4(sp),d0
+ add.l #3,d0
+ move.l #~3,d1
+ and.l d1,d0
+ move.l d0,4(sp)
+ pea 17
+ trap #0
+ bcs 1b
+ move.l 4(sp),curbrk
+ clr.l d0
+ rts
+
+.sect .data
+curbrk: .data4 endbss
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _select
+_select: SYSTEM(SYS_select)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _send
+_send: SYSTEM(SYS_send)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sendmsg
+_sendmsg: SYSTEM(SYS_sendmsg)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sendto
+_sendto: SYSTEM(SYS_sendto)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setdomainname
+_setdomainname: SYSTEM(SYS_setdomainname)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setdopt
+_setdopt: SYSTEM(SYS_setdopt)
--- /dev/null
+setgid(u)
+{
+ return setregid(u,u);
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setgroups
+_setgroups: SYSTEM(SYS_setgroups)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sethostname
+_sethostname: SYSTEM(SYS_sethostname)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setitimer
+_setitimer: SYSTEM(SYS_setitimer)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setpgrp
+_setpgrp: SYSTEM(SYS_setpgrp)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setpriority
+_setpriority: SYSTEM(SYS_setpriority)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setregid
+_setregid: SYSTEM(SYS_setregid)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setreuid
+_setreuid: SYSTEM(SYS_setreuid)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setrlimit
+_setrlimit: SYSTEM(SYS_setrlimit)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _setsockopt
+_setsockopt: SYSTEM(SYS_setsockopt)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _settimeofday
+_settimeofday: SYSTEM(SYS_settimeofday)
--- /dev/null
+setuid(u)
+{
+ return setreuid(u,u);
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _shutdown
+_shutdown: SYSTEM(SYS_shutdown)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sigblock
+_sigblock: SYSTEM(SYS_sigblock)
--- /dev/null
+static long masks[32];
+static long flags[32];
+int (*
+signal(sig,handler))()
+ int (*handler)();
+{
+ struct {
+ int (*sv_handler)();
+ long sv_mask;
+ long sv_flags;
+ } v, ov;
+
+ v.sv_handler = handler;
+ v.sv_mask = masks[sig];
+ v.sv_flags = flags[sig];
+ if (sigvec(sig,&v, &ov) < 0) return (int (*)()) -1;
+ if (v.sv_mask != ov.sv_mask || v.sv_flags != ov.sv_flags) {
+ v.sv_mask = ov.sv_mask;
+ masks[sig] = ov.sv_mask;
+ v.sv_flags = ov.sv_flags;
+ flags[sig] = ov.sv_flags;
+ if (sigvec(sig,&v,(char *) 0) < 0) return (int (*)()) -1;
+ }
+ return ov.sv_handler;
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sigpause
+_sigpause: SYSTEM(SYS_sigpause)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sigsetmask
+_sigsetmask: SYSTEM(SYS_sigsetmask)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sigstack
+_sigstack: SYSTEM(SYS_sigstack)
--- /dev/null
+.sect .text
+.define __sigtramp
+__sigtramp:
+ movem.l d0/d1/a0/a1,-(sp)
+ move.l _sigfunc,d1
+ move.l 0x14(sp),d0
+ lsl.l #2,d0
+ add.l d1,d0
+ move.l d0,a0
+ move.l (a0),a0
+ move.l 0x1c(sp),-(sp)
+ move.l 0x1c(sp),-(sp)
+ move.l 0x1c(sp),-(sp)
+ jsr (a0)
+ add.l #12,sp
+ movem.l (sp)+,d0/d1/a0/a1
+ add.l #8,sp
+ pea 0x8b
+ trap #0
--- /dev/null
+#include "syscall.h"
+#include <errno.h>
+struct sigvec { int (*handler)(); int mask,flags; };
+int (*(_sigfunc[32]))();
+extern int _sigtramp();
+
+sigvec(sig,vec,ovec)
+ register struct sigvec *vec;
+ struct sigvec *ovec;
+{
+ struct sigvec tmp;
+ int (*old)();
+
+ if ((unsigned) sig >= 32) {
+ errno = EINVAL;
+ return -1;
+ }
+ old = _sigfunc[sig];
+ if (vec) {
+ tmp = *vec;
+ vec = &tmp;
+ if (vec->handler && vec->handler != (int (*)()) 1) {
+ _sigfunc[sig] = vec->handler;
+ vec->handler = _sigtramp;
+ }
+ }
+ if (syscall(SYS_sigvec,sig,vec,ovec) < 0) {
+ _sigfunc[sig] = old;
+ return -1;
+ }
+ if (ovec->handler == _sigtramp) {
+ ovec->handler = old;
+ }
+ return 0;
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _socket
+_socket: SYSTEM(SYS_socket)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _socketpair
+_socketpair: SYSTEM(SYS_socketpair)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sstk
+_sstk: SYSTEM(SYS_sstk)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _stat
+_stat: SYSTEM(SYS_stat)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _statfs
+_statfs: SYSTEM(SYS_statfs)
--- /dev/null
+stime(tp)
+ long *tp;
+{
+ struct { long l1,l2; } x;
+
+ x.l1 = *tp;
+ x.l2 = 0;
+ return settimeofday(&x, (char *) 0);
+}
--- /dev/null
+#include <sgtty.h>
+int stty(fildes,argp)
+ int fildes ;
+ struct sgttyb *argp ;
+{
+ return ioctl(fildes,TIOCSETP,argp) ;
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _swapon
+_swapon: SYSTEM(SYS_swapon)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _symlink
+_symlink: SYSTEM(SYS_symlink)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _sync
+_sync: SYSTEM(SYS_sync)
--- /dev/null
+#define SYSTEM(sys) pea sys; trap #0; bcs 1f; rts; 1: jmp cerror
+#define SYS_exit 1
+#define SYS_fork 2
+#define SYS_read 3
+#define SYS_write 4
+#define SYS_open 5
+#define SYS_close 6
+#define SYS_creat 8
+#define SYS_link 9
+#define SYS_unlink 10
+#define SYS_execv 11
+#define SYS_chdir 12
+#define SYS_mknod 14
+#define SYS_chmod 15
+#define SYS_chown 16
+#define SYS_lseek 19
+#define SYS_getpid 20
+#define SYS_getuid 24
+#define SYS_ptrace 26
+#define SYS_access 33
+#define SYS_sync 36
+#define SYS_kill 37
+#define SYS_stat 38
+#define SYS_lstat 40
+#define SYS_dup 41
+#define SYS_pipe 42
+#define SYS_profil 44
+#define SYS_getgid 47
+#define SYS_acct 51
+#define SYS_ioctl 54
+#define SYS_reboot 55
+#define SYS_symlink 57
+#define SYS_readlink 58
+#define SYS_execve 59
+#define SYS_umask 60
+#define SYS_chroot 61
+#define SYS_fstat 62
+#define SYS_getpagesize 64
+#define SYS_mremap 65
+#define SYS_vfork 66
+#define SYS_sbrk 69
+#define SYS_sstk 70
+#define SYS_mmap 71
+#define SYS_vadvise 72
+#define SYS_munmap 73
+#define SYS_mprotect 74
+#define SYS_madvise 75
+#define SYS_vhangup 76
+#define SYS_mincore 78
+#define SYS_getgroups 79
+#define SYS_setgroups 80
+#define SYS_getpgrp 81
+#define SYS_setpgrp 82
+#define SYS_setitimer 83
+#define SYS_wait 84
+#define SYS_swapon 85
+#define SYS_getitimer 86
+#define SYS_gethostname 87
+#define SYS_sethostname 88
+#define SYS_getdtablesize 89
+#define SYS_dup2 90
+#define SYS_getdopt 91
+#define SYS_fcntl 92
+#define SYS_select 93
+#define SYS_setdopt 94
+#define SYS_fsync 95
+#define SYS_setpriority 96
+#define SYS_socket 97
+#define SYS_connect 98
+#define SYS_accept 99
+#define SYS_getpriority 100
+#define SYS_send 101
+#define SYS_recv 102
+#define SYS_bind 104
+#define SYS_setsockopt 105
+#define SYS_listen 106
+#define SYS_sigvec 108
+#define SYS_sigblock 109
+#define SYS_sigsetmask 110
+#define SYS_sigpause 111
+#define SYS_sigstack 112
+#define SYS_recvmsg 113
+#define SYS_sendmsg 114
+#define SYS_gettimeofday 116
+#define SYS_getrusage 117
+#define SYS_getsockopt 118
+#define SYS_readv 120
+#define SYS_writev 121
+#define SYS_settimeofday 122
+#define SYS_fchown 123
+#define SYS_fchmod 124
+#define SYS_recvfrom 125
+#define SYS_setreuid 126
+#define SYS_setregid 127
+#define SYS_rename 128
+#define SYS_truncate 129
+#define SYS_ftruncate 130
+#define SYS_flock 131
+#define SYS_sendto 133
+#define SYS_shutdown 134
+#define SYS_socketpair 135
+#define SYS_mkdir 136
+#define SYS_rmdir 137
+#define SYS_utimes 138
+#define SYS_adjtime 140
+#define SYS_getpeername 141
+#define SYS_gethostid 142
+#define SYS_getrlimit 144
+#define SYS_setrlimit 145
+#define SYS_killpg 146
+#define SYS_getsockname 150
+#define SYS_nfssvc 155
+#define SYS_getdirentries 156
+#define SYS_statfs 157
+#define SYS_fstatfs 158
+#define SYS_unmount 159
+#define SYS_async_daemon 160
+#define SYS_getfh 161
+#define SYS_getdomainname 162
+#define SYS_setdomainname 163
+#define SYS_quotactl 165
+#define SYS_exportfs 166
+#define SYS_mount 167
+#define SYS_ustat 168
+#define SYS_semsys 169
+#define SYS_msgsys 170
+#define SYS_shmsys 171
--- /dev/null
+.sect .text
+.define _syscall
+_syscall:
+ move.l 4(sp),d0
+ move.l (sp),4(sp)
+ move.l d0,(sp)
+ trap #0
+ bcs 1f
+ move.l (sp),a0
+ jmp (a0)
+1:
+ move.l (sp),a0
+ move.l a0,-(sp)
+ jmp cerror
--- /dev/null
+long
+tell(f)
+{
+ long lseek();
+
+ return lseek(f, 0L, 1);
+}
--- /dev/null
+long
+time(loc)
+ long *loc;
+{
+ struct { long l1,l2; } t1;
+
+ if (gettimeofday(&t1, (char *) 0) < 0) {
+ return -1;
+ }
+ if (loc) *loc = t1.l1;
+ return t1.l1;
+}
--- /dev/null
+#include <sys/types.h>
+
+#define Xval(xx) ((xx).l1*60+(xx).l2/(100000/6))
+
+times(bp)
+ struct { time_t l1,l2,l3,l4;} *bp;
+{
+ struct { struct { long l1,l2; }s1,s2; long x[20]; } t;
+ if (getrusage(0,&t) < 0) return -1;
+ bp->l1 = Xval(t.s1);
+ bp->l2 = Xval(t.s2);
+ if (getrusage(-1,&t) < 0) return -1;
+ bp->l3 = Xval(t.s1);
+ bp->l4 = Xval(t.s2);
+ return 0;
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _truncate
+_truncate: SYSTEM(SYS_truncate)
--- /dev/null
+#include <errno.h>
+
+ulimit(cmd, newlimit)
+ long newlimit;
+{
+ extern int errno;
+ struct {
+ long soft, hard;
+ } x;
+
+ switch(cmd) {
+ case 1:
+ if (getrlimit(1, &x) < 0) return -1;
+ return ((x.soft + 511) & ~511) >> 9;
+ case 2:
+ x.soft = x.hard = (newlimit << 9);
+ if (setrlimit(1, &x) < 0) return -1;
+ return x.soft;
+ case 3:
+ if (getrlimit(2, &x) < 0) return -1;
+ return x.soft;
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _umask
+_umask: SYSTEM(SYS_umask)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _unlink
+_unlink: SYSTEM(SYS_unlink)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _unmount
+_unmount: SYSTEM(SYS_unmount)
--- /dev/null
+#include <sys/types.h>
+
+utime(file, timep)
+ char *file;
+ time_t timep[2];
+{
+ struct { long l1,l2,l3,l4; } x;
+
+ x.l2 = x.l4 = 0;
+ x.l1 = timep[0];
+ x.l3 = timep[1];
+ return utimes(file,&x);
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _utimes
+_utimes: SYSTEM(SYS_utimes)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _vadvise
+_vadvise: SYSTEM(SYS_vadvise)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _vfork
+_vfork:
+ move.l (sp)+,a0
+ pea SYS_vfork
+ trap #0
+ bcs 1f
+ tst.l d1
+ bne 2f
+ jmp (a0)
+1:
+ move.l d0,_errno
+ move.l #-1,d0
+ jmp (a0)
+2:
+ clr.l d0
+ jmp (a0)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _vhangup
+_vhangup: SYSTEM(SYS_vhangup)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _wait
+_wait:
+ pea SYS_wait
+ trap #0
+ bcs 1f
+ tst.l 4(sp)
+ beq 2f
+ move.l 4(sp),a0
+ move.l d1,(a0)
+2:
+ rts
+1:
+ jmp cerror
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _wait3
+_wait3:
+ move.l 8(sp),d0
+ move.l 12(sp),d1
+ pea SYS_wait
+ or.b #0x1f,ccr
+ trap #0
+ bcc 1f
+ jmp cerror
+1:
+ tst.l 4(sp)
+ beq 1f
+ move.l 4(sp),a0
+ move.l d1,(a0)
+1:
+ rts
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _write
+_write: SYSTEM(SYS_write)
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _writev
+_writev: SYSTEM(SYS_writev)