--- /dev/null
+LIST
+Makefile
+compmodule
+head_em.s
+libmon_s.a
--- /dev/null
+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
--- /dev/null
+# $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
--- /dev/null
+This library is incomplete. Of some Xenix systemcalls the interface is
+not implemented.
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __exit
+.sect .text
+__exit:
+ mov ax,1
+ callf 0x7:0x0
+ jmp cerror
--- /dev/null
+.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
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __profil
+.sect .text
+__profil:
+ mov ax,44
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __stime
+.sect .text
+__stime:
+ mov ax,25
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define __time
+.sect .text
+__time:
+ mov ax,13
+ jmp syscal
--- /dev/null
+.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
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _access
+.sect .text
+_access:
+ mov ax,33
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _acct
+.sect .text
+_acct:
+ mov ax,51
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _alarm
+.sect .text
+_alarm:
+ mov ax,27
+ jmp syscal
--- /dev/null
+.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
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _chdir
+.sect .text
+_chdir:
+ mov ax,12
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _chmod
+.sect .text
+_chmod:
+ mov ax,15
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _chown
+.sect .text
+_chown:
+ mov ax,16
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _chroot
+.sect .text
+_chroot:
+ mov ax,61
+ jmp sysx
--- /dev/null
+_cleanup() { }
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _close
+.sect .text
+_close:
+ mov ax,6
+ jmp sysx
--- /dev/null
+if i386 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _creat
+.sect .text
+_creat:
+ mov ax,8
+ jmp syscal
--- /dev/null
+int
+dup(d)
+{
+ return __xdup(d, 0);
+}
--- /dev/null
+int
+dup2(oldd, newd)
+{
+ oldd |= 64;
+ return __xdup(oldd, newd);
+}
--- /dev/null
+int
+execl(name,args)
+ char *name;
+ int args;
+{
+ extern char **environ;
+
+ return execve(name,&args,environ);
+}
--- /dev/null
+int
+execle(name,args)
+ char *name;
+ char *args;
+{
+ char **p = &args;
+ while (*p++) ;
+
+ return execve(name,&args,*p);
+}
--- /dev/null
+int
+execv(name,args)
+ char *name;
+ char **args;
+{
+ extern char **environ;
+ return execve(name,args,environ);
+}
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _execve
+.sect .text
+_execve:
+ mov ax,59
+ callf 0x7:0x0
+ jmp cerror
--- /dev/null
+exit(n)
+{
+ _cleanup();
+ _exit(n);
+}
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _fcntl
+.sect .text
+_fcntl:
+ mov ax,62
+ jmp syscal
--- /dev/null
+.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
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _fstat
+.sect .text
+_fstat:
+ mov ax,28
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _ftime
+.sect .text
+_ftime:
+ mov ax,2856
+ jmp syscal
--- /dev/null
+.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
--- /dev/null
+.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
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _getgid
+.sect .text
+_getgid:
+ mov ax,47
+ jmp syscal
--- /dev/null
+.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
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _getpid
+.sect .text
+_getpid:
+ mov ax,20
+ jmp syscal
--- /dev/null
+.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
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _getuid
+.sect .text
+_getuid:
+ mov ax,24
+ jmp syscal
--- /dev/null
+gtty(fildes, arg)
+ char *arg;
+{
+ return ioctl(fildes, ('t' << 8) | 8, arg);
+}
--- /dev/null
+.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:
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _ioctl
+.sect .text
+_ioctl:
+ mov ax,54
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _kill
+.sect .text
+_kill:
+ mov ax,37
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _link
+.sect .text
+_link:
+ mov ax,9
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _lseek
+.sect .text
+_lseek:
+ mov ax,19
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _mknod
+.sect .text
+_mknod:
+ mov ax,14
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _mount
+.sect .text
+_mount:
+ mov ax,21
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _nice
+.sect .text
+_nice:
+ mov ax,34
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _open
+.sect .text
+_open:
+ mov ax,5
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _pause
+.sect .text
+_pause:
+ mov ax,29
+ jmp syscal
--- /dev/null
+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;
+}
--- /dev/null
+profil(buff, bufsiz, offset, scale)
+ char *buff;
+ int (*offset)();
+{
+ _profil(buff, bufsiz, offset, scale, 7262);
+}
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _read
+.sect .text
+_read:
+ mov ax,3
+ jmp syscal
--- /dev/null
+.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
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _setgid
+.sect .text
+_setgid:
+ mov ax,46
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _setuid
+.sect .text
+_setuid:
+ mov ax,23
+ jmp sysx
--- /dev/null
+.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
+
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _stat
+.sect .text
+_stat:
+ mov ax,18
+ jmp sysx
--- /dev/null
+stime(p)
+ long *p;
+{
+ return _stime(*p);
+}
--- /dev/null
+stty(fildes, arg)
+ char *arg;
+{
+ return ioctl(fildes, ('t' << 8) | 9, arg);
+}
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _sync
+.sect .text
+_sync:
+ mov ax,36
+ jmp syscal
--- /dev/null
+.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
+
--- /dev/null
+long _time();
+
+long
+time(p)
+ long *p;
+{
+ long l = _time();
+ if (p) *p = l;
+
+ return l;
+}
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _times
+.sect .text
+_times:
+ mov ax,43
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _ulimit
+.sect .text
+_ulimit:
+ mov ax,63
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _umask
+.sect .text
+_umask:
+ mov ax,60
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _umount
+.sect .text
+_umount:
+ mov ax,22
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _uname
+.sect .text
+_uname:
+ mov ax,57
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _unlink
+.sect .text
+_unlink:
+ mov ax,10
+ jmp sysx
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _utime
+.sect .text
+_utime:
+ mov ax,30
+ jmp sysx
--- /dev/null
+long _wait();
+
+wait(p)
+ int *p;
+{
+ long l = _wait();
+
+ if (l == -1) return -1;
+ if (p) *p = (l >> 16);
+ return l & 0xffff;
+}
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define _write
+.sect .text
+_write:
+ mov ax,4
+ jmp syscal
--- /dev/null
+.sect .text; .sect .rom; .sect .data; .sect .bss
+.define ___xdup
+.sect .text
+___xdup:
+ mov ax,41
+ jmp syscal