Initial revision

This commit is contained in:
ceriel 1987-01-08 10:41:08 +00:00
parent 037c2426ab
commit c2805a25bd
54 changed files with 671 additions and 0 deletions

52
mach/i86/libsys/LIST Normal file
View file

@ -0,0 +1,52 @@
tail_mon.a
exit.s
_exit.s
abort.s
access.s
chdir.s
chmod.s
chown.s
cleanup.s
close.s
creat.s
dup.s
execl.s
execle.s
execv.s
execve.s
time.s
exece.s
fork.s
fstat.s
getgid.s
getpid.s
getuid.s
gtty.s
stty.s
ioctl.s
kill.s
link.s
lseek.s
mknod.s
mount.s
nice.s
open.s
pipe.s
profil.s
read.s
sbrk.s
brk.s
setgid.s
setuid.s
signal.s
stat.s
sync.s
umount.s
unlink.s
wait.s
write.s
cerror.s
error.s
pause.s
alarm.s
ftime.s

21
mach/i86/libsys/Makefile Normal file
View file

@ -0,0 +1,21 @@
# $Header$
MACH=l86
all: tail_mon
install: all
../../install tail_mon
cmp: all
-../../compare tail_mon
tail_mon:
ASAR=aal ; export ASAR ;\
march . tail_mon
clean:
rm -f *.o
opr :
make pr | opr
pr:
@ar pv tail_mon.a

10
mach/i86/libsys/_exit.s Normal file
View file

@ -0,0 +1,10 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __exit
.sect .text
__exit:
mov bx,sp
xor ax,ax
push ax ! unused memory
push 2(bx)
push ax ! dummy return address
int 0x81

13
mach/i86/libsys/abort.s Normal file
View file

@ -0,0 +1,13 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _abort
.extern _abort
_abort: push si
push di
push bp
mov bp,sp
int 128
mov sp,bp
pop bp
pop di
pop si
ret

9
mach/i86/libsys/access.s Normal file
View file

@ -0,0 +1,9 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _access
.extern _access, cerror
_access: int 0xa1
jb 9f
xor ax,ax
ret
9:
jmp cerror

8
mach/i86/libsys/alarm.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _alarm
.extern _alarm, cerror
_alarm: int 0x9b
jb 9f
ret
9:
jmp cerror

39
mach/i86/libsys/brk.s Normal file
View file

@ -0,0 +1,39 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _brk
.define xbrk
.define np
.extern _brk
.extern xbrk
.extern np, cerror
_brk:
mov bx,sp
mov ax,2(bx)
mov cx,sp
sub cx,128
jbe 1f
mov bx,(np)
mov (np),ax
sub ax,bx
jbe 2f
call xbrk
2:
xor ax,ax
ret
1:
mov ax,0xc
jmp cerror
xbrk:
push di
mov di,bx
mov cx,ax
xor ax,ax
shr cx,1
repz stos
jae 3f
stosb
3:
pop di
ret
.sect .data
np: .data2 0
.sect .text

9
mach/i86/libsys/cerror.s Normal file
View file

@ -0,0 +1,9 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define cerror
.extern cerror
.extern _errno
cerror:
mov (_errno),ax
mov dx,-1
mov ax,dx
ret

8
mach/i86/libsys/chdir.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _chdir
.extern _chdir, cerror
_chdir: int 0x8c
jb 9f
xor ax,ax
ret
9: jmp cerror

8
mach/i86/libsys/chmod.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _chmod
.extern _chmod, cerror
_chmod: int 0x8f
jb 9f
xor ax,ax
ret
9: jmp cerror

8
mach/i86/libsys/chown.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _chown
.extern _chown, cerror
_chown: int 0x90
jb 9f
xor ax,ax
ret
9: jmp cerror

View file

@ -0,0 +1,9 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define __cleanup
.extern __cleanup
__cleanup:
push bp
mov bp,sp
mov sp,bp
pop bp
ret

8
mach/i86/libsys/close.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _close
.extern _close, cerror
_close: int 0x86
jb 9f
xor ax,ax
ret
9: jmp cerror

4
mach/i86/libsys/compmodule Executable file
View file

@ -0,0 +1,4 @@
if i86 -c $1 1>&2
then echo `basename $1 $2`.o
else exit 1
fi

7
mach/i86/libsys/creat.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _creat
.extern _creat, cerror
_creat: int 0x88
jb 9f
ret
9: jmp cerror

8
mach/i86/libsys/dup.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _dup
.extern _dup, cerror
_dup: int 0xc9
jb 9f
ret
9: jmp cerror

7
mach/i86/libsys/error.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _errno
.extern _errno
_errno:
.space 2
.sect .text

7
mach/i86/libsys/exece.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _exece
.extern _exece, cerror
_exece: int 0xdb
jb 9f
ret
9: jmp cerror

20
mach/i86/libsys/execl.s Normal file
View file

@ -0,0 +1,20 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _execl
.extern _execl, _environ, _execve
_execl:
push si
push di
push bp
mov bp,sp
push (_environ)
lea ax,10(bp)
push ax
push 8(bp)
call _execve
add sp,6
mov sp,bp
pop bp
pop di
pop si
ret

24
mach/i86/libsys/execle.s Normal file
View file

@ -0,0 +1,24 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _execle
.extern _execle, _execve
_execle:
push si
push di
push bp
mov bp,sp
lea si,10(bp)
1: mov di,si
add si,2
cmp (di),0
jne 1b
push (si)
lea ax,10(bp)
push ax
push 8(bp)
call _execve
add sp,6
mov sp,bp
pop bp
pop di
pop si
ret

12
mach/i86/libsys/execv.s Normal file
View file

@ -0,0 +1,12 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _execv
.extern _execv, _environ, cerror
_execv:
mov bx,sp
push (_environ)
push 4(bx)
push 2(bx)
push ax
int 0xbb
add sp,8
jmp cerror

8
mach/i86/libsys/execve.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _execve
.extern _execve, cerror
_execve:
int 0x8b
jb 9f
ret
9: jmp cerror

13
mach/i86/libsys/exit.s Normal file
View file

@ -0,0 +1,13 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _exit
.extern _exit, __cleanup, __exit
_exit:
push bp
mov bp,sp
call __cleanup
push 4(bp)
call __exit
pop si
mov sp,bp
pop bp
ret

11
mach/i86/libsys/fork.s Normal file
View file

@ -0,0 +1,11 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _fork
.extern _fork, cerror
_fork: int 0x82
jmp 1f
jae 2f
jmp cerror
1:
xor ax,ax
2:
ret

8
mach/i86/libsys/fstat.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _fstat
.extern _fstat, cerror
_fstat: int 0x9c
jb 9f
xor ax,ax
ret
9: jmp cerror

8
mach/i86/libsys/ftime.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _ftime
.extern _ftime, cerror
_ftime: int 0xa3
jb 9f
ret
9:
jmp cerror

8
mach/i86/libsys/getgid.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _getgid
.extern _getgid, cerror
_getgid: int 0xaf
jb 9f
ret
9:
jmp cerror

8
mach/i86/libsys/getpid.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _getpid
.extern _getpid, cerror
_getpid: int 0x94
jb 9f
ret
9:
jmp cerror

8
mach/i86/libsys/getuid.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _getuid
.extern _getuid, cerror
_getuid: int 0x98
jb 9f
ret
9:
jmp cerror

15
mach/i86/libsys/gtty.s Normal file
View file

@ -0,0 +1,15 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _gtty
.extern _gtty, _ioctl
_gtty:
push bp
mov bp,sp
push 6(bp)
mov ax,29704
push ax
push 4(bp)
call _ioctl
add sp,6
mov sp,bp
pop bp
ret

7
mach/i86/libsys/ioctl.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _ioctl
.extern _ioctl, cerror
_ioctl: int 0xb6
jb 9f
ret
9: jmp cerror

8
mach/i86/libsys/kill.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _kill
.extern _kill, cerror
_kill: int 0xa5
jb 9f
xor ax,ax
ret
9: jmp cerror

7
mach/i86/libsys/link.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _link
.extern _link, cerror
_link: int 0x89
jb 9f
ret
9: jmp cerror

7
mach/i86/libsys/lseek.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _lseek
.extern _lseek, cerror
_lseek: int 0x93
jb 9f
ret
9: jmp cerror

8
mach/i86/libsys/mknod.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _mknod
.extern _mknod, cerror
_mknod: int 0x8e
jb 9f
xor ax,ax
ret
9: jmp cerror

8
mach/i86/libsys/mount.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _mount
.extern _mount, cerror
_mount: int 0x95
jb 9f
xor ax,ax
ret
9: jmp cerror

8
mach/i86/libsys/nice.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _nice
.extern _nice, cerror
_nice: int 0xa2
jb 9f
ret
9:
jmp cerror

7
mach/i86/libsys/open.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _open
.extern _open, cerror
_open: int 0x85
jb 9f
ret
9: jmp cerror

8
mach/i86/libsys/pause.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _pause
.extern _pause, cerror
_pause: int 0x9d
jb 9f
ret
9:
jmp cerror

8
mach/i86/libsys/pipe.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _pipe
.extern _pipe, cerror
_pipe: int 0xaa
jb 9f
xor ax,ax
ret
9: jmp cerror

8
mach/i86/libsys/profil.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _profil
.extern _profil, cerror
_profil: int 0xac
jb 9f
ret
9:
jmp cerror

7
mach/i86/libsys/read.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _read
.extern _read, cerror
_read: int 0x83
jb 9f
ret
9: jmp cerror

25
mach/i86/libsys/sbrk.s Normal file
View file

@ -0,0 +1,25 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _sbrk
.extern _sbrk, xbrk, cerror
_sbrk:
push bp
mov bp,sp
mov ax,4(bp)
mov bx,(np)
add ax,bx
mov cx,sp
sub cx,128
sub cx,ax
jbe 1f
mov (np),ax
sub ax,bx
jbe 2f
call xbrk
2:
mov ax,bx
pop bp
ret
1:
mov ax,0xc
pop bp
jmp cerror

8
mach/i86/libsys/setgid.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _setgid
.extern _setgid, cerror
setgid: int 0xae
jb 9f
xor ax,ax
ret
9: jmp cerror

8
mach/i86/libsys/setuid.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _setuid
.extern _setuid, cerror
_setuid: int 0x97
jb 9f
xor ax,ax
ret
9: jmp cerror

62
mach/i86/libsys/signal.s Normal file
View file

@ -0,0 +1,62 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _signal
.extern _signal, cerror
NSIG=16
_signal: mov bx,sp
mov cx,4(bx)
mov bx,2(bx)
cmp bx,NSIG
jae 1f
shl bx,1
mov dx,dvect(bx)
cmp cx,1
jbe 2f
mov dvect(bx),cx
mov bx,sp
mov 4(bx),enter
mov bx,dx
int 0xb0
mov dx,bx
mov bx,sp
mov 4(bx),cx
jb 3f
jmp 4f
2:
int 0xb0
jb 3f
mov dvect(bx),cx
4:
cmp ax,1
jbe 5f
mov ax,dx
5:
ret
1:
mov ax,22
3:
jmp cerror
enter:
push bx
push cx
push dx
push di
push si
mov bx,sp
mov di,10(bx)
mov 10(bx),ax
push di
shl di,1
call dvect(di)
add sp,2
pop si
pop di
pop dx
pop cx
pop bx
pop ax
popf
ret
.sect .bss
dvect: .space 2*NSIG
.sect .text

8
mach/i86/libsys/stat.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _stat
.extern _stat, cerror
_stat: int 0x92
jb 9f
xor ax,ax
ret
9: jmp cerror

15
mach/i86/libsys/stty.s Normal file
View file

@ -0,0 +1,15 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _stty
.extern _stty, _ioctl
_stty:
push bp
mov bp,sp
push 6(bp)
mov ax,29705
push ax
push 4(bp)
call _ioctl
add sp,6
mov sp,bp
pop bp
ret

8
mach/i86/libsys/sync.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _sync
.extern _sync, cerror
_sync: int 0xa4
jb 9f
ret
9:
jmp cerror

27
mach/i86/libsys/time.s Normal file
View file

@ -0,0 +1,27 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _time
.extern _time, _ftime
_time:
push si
push di
push bp
mov bp,sp
sub sp,10
lea ax,-10(bp)
push ax
call _ftime
add sp,2
cmp 8(bp),0
je 1f
mov ax,-10(bp)
mov dx,-8(bp)
mov di,8(bp)
mov (di),ax
mov 2(di),dx
1: mov ax,-10(bp)
mov dx,-8(bp)
mov sp,bp
pop bp
pop di
pop si
ret

9
mach/i86/libsys/umount.s Normal file
View file

@ -0,0 +1,9 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _umount
.extern _umount, cerror
_umount: int 0x96
jb 9f
xor ax,ax
ret
9:
jmp cerror

8
mach/i86/libsys/unlink.s Normal file
View file

@ -0,0 +1,8 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _unlink
.extern _unlink, cerror
_unlink: int 0x8a
jb 9f
xor ax,ax
ret
9: jmp cerror

17
mach/i86/libsys/wait.s Normal file
View file

@ -0,0 +1,17 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _wait
.extern _wait, cerror
_wait:
mov bx,sp
mov ax,2 ! void info about unused memory
! Should be 0 according to /usr/include/sys.s, but
! that doesn't work
push ax
push 2(bx)
push ax ! dummy return address
int 0x87
jb 9f
add sp,6
ret
9: add sp,6
jmp cerror

7
mach/i86/libsys/write.s Normal file
View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
.define _write
.extern _write, cerror
_write: int 0x84
jb 9f
ret
9: jmp cerror