initial version

This commit is contained in:
ceriel 1989-10-10 11:40:55 +00:00
parent 010bade227
commit 48252cc673
74 changed files with 719 additions and 0 deletions

5
mach/i386/libsys/.distr Normal file
View file

@ -0,0 +1,5 @@
LIST
Makefile
compmodule
head_em.s
libmon_s.a

69
mach/i386/libsys/LIST Normal file
View file

@ -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

28
mach/i386/libsys/Makefile Normal file
View file

@ -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

2
mach/i386/libsys/TODO Normal file
View file

@ -0,0 +1,2 @@
This library is incomplete. Of some Xenix systemcalls the interface is
not implemented.

7
mach/i386/libsys/_exit.s Normal file
View file

@ -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

12
mach/i386/libsys/_pipe.s Normal file
View file

@ -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

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __profil
.sect .text
__profil:
mov ax,44
jmp syscal

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __stime
.sect .text
__stime:
mov ax,25
jmp sysx

6
mach/i386/libsys/_time.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __time
.sect .text
__time:
mov ax,13
jmp syscal

12
mach/i386/libsys/_wait.s Normal file
View file

@ -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

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _access
.sect .text
_access:
mov ax,33
jmp sysx

6
mach/i386/libsys/acct.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _acct
.sect .text
_acct:
mov ax,51
jmp sysx

6
mach/i386/libsys/alarm.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _alarm
.sect .text
_alarm:
mov ax,27
jmp syscal

13
mach/i386/libsys/brk.s Normal file
View file

@ -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

6
mach/i386/libsys/chdir.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _chdir
.sect .text
_chdir:
mov ax,12
jmp sysx

6
mach/i386/libsys/chmod.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _chmod
.sect .text
_chmod:
mov ax,15
jmp sysx

6
mach/i386/libsys/chown.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _chown
.sect .text
_chown:
mov ax,16
jmp sysx

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _chroot
.sect .text
_chroot:
mov ax,61
jmp sysx

View file

@ -0,0 +1 @@
_cleanup() { }

6
mach/i386/libsys/close.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _close
.sect .text
_close:
mov ax,6
jmp sysx

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

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

6
mach/i386/libsys/creat.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _creat
.sect .text
_creat:
mov ax,8
jmp syscal

5
mach/i386/libsys/dup.c Normal file
View file

@ -0,0 +1,5 @@
int
dup(d)
{
return __xdup(d, 0);
}

6
mach/i386/libsys/dup2.c Normal file
View file

@ -0,0 +1,6 @@
int
dup2(oldd, newd)
{
oldd |= 64;
return __xdup(oldd, newd);
}

9
mach/i386/libsys/execl.c Normal file
View file

@ -0,0 +1,9 @@
int
execl(name,args)
char *name;
int args;
{
extern char **environ;
return execve(name,&args,environ);
}

10
mach/i386/libsys/execle.c Normal file
View file

@ -0,0 +1,10 @@
int
execle(name,args)
char *name;
char *args;
{
char **p = &args;
while (*p++) ;
return execve(name,&args,*p);
}

8
mach/i386/libsys/execv.c Normal file
View file

@ -0,0 +1,8 @@
int
execv(name,args)
char *name;
char **args;
{
extern char **environ;
return execve(name,args,environ);
}

View file

@ -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

5
mach/i386/libsys/exit.c Normal file
View file

@ -0,0 +1,5 @@
exit(n)
{
_cleanup();
_exit(n);
}

6
mach/i386/libsys/fcntl.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _fcntl
.sect .text
_fcntl:
mov ax,62
jmp syscal

18
mach/i386/libsys/fork.s Normal file
View file

@ -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

6
mach/i386/libsys/fstat.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _fstat
.sect .text
_fstat:
mov ax,28
jmp sysx

6
mach/i386/libsys/ftime.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _ftime
.sect .text
_ftime:
mov ax,2856
jmp syscal

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _getgid
.sect .text
_getgid:
mov ax,47
jmp syscal

View file

@ -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

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _getpid
.sect .text
_getpid:
mov ax,20
jmp syscal

View file

@ -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

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _getuid
.sect .text
_getuid:
mov ax,24
jmp syscal

5
mach/i386/libsys/gtty.c Normal file
View file

@ -0,0 +1,5 @@
gtty(fildes, arg)
char *arg;
{
return ioctl(fildes, ('t' << 8) | 8, arg);
}

View file

@ -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:

6
mach/i386/libsys/ioctl.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _ioctl
.sect .text
_ioctl:
mov ax,54
jmp syscal

6
mach/i386/libsys/kill.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _kill
.sect .text
_kill:
mov ax,37
jmp sysx

6
mach/i386/libsys/link.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _link
.sect .text
_link:
mov ax,9
jmp sysx

6
mach/i386/libsys/lseek.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _lseek
.sect .text
_lseek:
mov ax,19
jmp syscal

6
mach/i386/libsys/mknod.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _mknod
.sect .text
_mknod:
mov ax,14
jmp sysx

6
mach/i386/libsys/mount.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _mount
.sect .text
_mount:
mov ax,21
jmp sysx

6
mach/i386/libsys/nice.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _nice
.sect .text
_nice:
mov ax,34
jmp syscal

6
mach/i386/libsys/open.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _open
.sect .text
_open:
mov ax,5
jmp syscal

6
mach/i386/libsys/pause.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _pause
.sect .text
_pause:
mov ax,29
jmp syscal

14
mach/i386/libsys/pipe.c Normal file
View file

@ -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;
}

View file

@ -0,0 +1,6 @@
profil(buff, bufsiz, offset, scale)
char *buff;
int (*offset)();
{
_profil(buff, bufsiz, offset, scale, 7262);
}

6
mach/i386/libsys/read.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _read
.sect .text
_read:
mov ax,3
jmp syscal

29
mach/i386/libsys/sbrk.s Normal file
View file

@ -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

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _setgid
.sect .text
_setgid:
mov ax,46
jmp sysx

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _setuid
.sect .text
_setuid:
mov ax,23
jmp sysx

38
mach/i386/libsys/signal.s Normal file
View file

@ -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

6
mach/i386/libsys/stat.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _stat
.sect .text
_stat:
mov ax,18
jmp sysx

5
mach/i386/libsys/stime.c Normal file
View file

@ -0,0 +1,5 @@
stime(p)
long *p;
{
return _stime(*p);
}

5
mach/i386/libsys/stty.c Normal file
View file

@ -0,0 +1,5 @@
stty(fildes, arg)
char *arg;
{
return ioctl(fildes, ('t' << 8) | 9, arg);
}

6
mach/i386/libsys/sync.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _sync
.sect .text
_sync:
mov ax,36
jmp syscal

23
mach/i386/libsys/sys.s Normal file
View file

@ -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

11
mach/i386/libsys/time.c Normal file
View file

@ -0,0 +1,11 @@
long _time();
long
time(p)
long *p;
{
long l = _time();
if (p) *p = l;
return l;
}

6
mach/i386/libsys/times.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _times
.sect .text
_times:
mov ax,43
jmp syscal

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _ulimit
.sect .text
_ulimit:
mov ax,63
jmp syscal

6
mach/i386/libsys/umask.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _umask
.sect .text
_umask:
mov ax,60
jmp syscal

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _umount
.sect .text
_umount:
mov ax,22
jmp sysx

6
mach/i386/libsys/uname.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _uname
.sect .text
_uname:
mov ax,57
jmp syscal

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _unlink
.sect .text
_unlink:
mov ax,10
jmp sysx

6
mach/i386/libsys/utime.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _utime
.sect .text
_utime:
mov ax,30
jmp sysx

11
mach/i386/libsys/wait.c Normal file
View file

@ -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;
}

6
mach/i386/libsys/write.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define _write
.sect .text
_write:
mov ax,4
jmp syscal

6
mach/i386/libsys/xdup.s Normal file
View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define ___xdup
.sect .text
___xdup:
mov ax,41
jmp syscal