Added entry points for ANSI C

This commit is contained in:
ceriel 1990-01-22 11:48:01 +00:00
parent c1b2a43ef5
commit dbe88218e4
28 changed files with 501 additions and 4 deletions

View file

@ -22,7 +22,6 @@ execl.e
execle.e execle.e
execv.e execv.e
execve.e execve.e
_exit.e
fork.e fork.e
fstat.e fstat.e
ftime.e ftime.e
@ -62,3 +61,28 @@ utime.e
wait.e wait.e
write.e write.e
errno.e errno.e
_alarm.e
_brk.e
_close.e
_creat.e
_dup.e
_dup2.e
_execl.e
_exit.e
_fork.e
_fstat.e
_ftime.e
_getpid.e
_gtty.c
_ioctl.e
_kill.e
_link.e
_lseek.e
_open.e
_pause.e
_pipe.e
_read.e
_sbrk.e
_unlink.e
_wait.e
_write.e

View file

@ -0,0 +1,9 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_alarm
pro $_alarm,0
lol 0
loc 27
mon
ret EM_WSIZE
end

54
lang/cem/libcc/mon/_brk.e Normal file
View file

@ -0,0 +1,54 @@
#
#include <em_abs.h>
mes 2,EM_WSIZE,EM_PSIZE
.1
bss EM_PSIZE,0,0
.2
bss EM_WSIZE,0,0
pro $ctch,0
lol 0
loc EHEAP
beq *1
lae .1
loi EM_PSIZE
sig
asp EM_PSIZE
lol 0
trp
rtt
1
loc 1
ste .2
rtt
end
exp $_brk
pro $_brk,0
lpi $ctch
sig
lae .1
sti EM_PSIZE
loc 0
ste .2
lal 0
loi EM_PSIZE
str 2 ; The - possibly - occurring trap is caught
lae .1
loi EM_PSIZE
sig
asp EM_PSIZE
loe .2
zgt *1
zer EM_PSIZE
ret EM_PSIZE
1
loc -1
loc EM_WSIZE
loc EM_PSIZE
cii
ret EM_PSIZE
end

View file

@ -0,0 +1,15 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_close
pro $_close,0
lol 0
loc 6
mon
zne *1
loc 0
ret EM_WSIZE
1
ste errno
loc -1
ret EM_WSIZE
end

View file

@ -0,0 +1,14 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_creat
pro $_creat,0
lal 0
loi EM_WSIZE+EM_PSIZE
loc 8
mon
zeq *1
ste errno ; since e==r0
loc -1
1
ret EM_WSIZE
end

14
lang/cem/libcc/mon/_dup.e Normal file
View file

@ -0,0 +1,14 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_dup
pro $_dup,0
lol 0
_dup EM_WSIZE
loc 41
mon
zeq *1
ste errno
loc -1
1
ret EM_WSIZE
end

View file

@ -0,0 +1,16 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_dup2
pro $_dup2,0
lal 0
loi 2*EM_WSIZE
loc 64
ior EM_WSIZE
loc 41
mon
zeq *1
ste errno
loc -1
1
ret EM_WSIZE
end

View file

@ -0,0 +1,15 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_execl
pro $_execl,0
lae _penvp
loi EM_PSIZE
lal EM_PSIZE
lal 0
loi EM_PSIZE
loc 59
mon
ste errno
loc -1
ret EM_WSIZE
end

View file

@ -0,0 +1,18 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_fork
pro $_fork,0
loc 2
mon
zeq *1
ste errno
loc -1
ret EM_WSIZE
1
zeq *2
asp EM_WSIZE
loc 0
2
ret EM_WSIZE
end

View file

@ -0,0 +1,16 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_fstat
pro $_fstat,0
lal 0
loi EM_WSIZE+EM_PSIZE
loc 28
mon
zne *1
loc 0
ret EM_WSIZE
1
ste errno
loc -1
ret EM_WSIZE
end

View file

@ -0,0 +1,10 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_ftime
pro $_ftime,0
lal 0
loi EM_PSIZE
loc 35
mon
ret 0
end

View file

@ -0,0 +1,8 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_getpid
pro $_getpid,0
loc 20
mon
ret EM_WSIZE
end

View file

@ -0,0 +1,6 @@
/* $Header$ */
#include <sgtty.h>
int
_gtty(fildes,argp) int fildes ; struct sgttyb *argp ; {
return _ioctl(fildes,TIOCGETP,argp) ;
}

View file

@ -0,0 +1,16 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_ioctl
pro $_ioctl,0
lal 0
loi EM_PSIZE+2*EM_WSIZE
loc 54
mon
zne *1
loc 0
ret EM_WSIZE
1
ste errno
loc -1
ret EM_WSIZE
end

View file

@ -0,0 +1,15 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_kill
pro $_kill,0
ldl 0
loc 37
mon
zne *1
loc 0
ret EM_WSIZE
1
ste errno
loc -1
ret EM_WSIZE
end

View file

@ -0,0 +1,16 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_link
pro $_link,0
lal 0
loi 2*EM_PSIZE
loc 9
mon
zne *1
loc 0
ret EM_WSIZE
1
ste errno
loc -1
ret EM_WSIZE
end

View file

@ -0,0 +1,33 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_lseek
pro $_lseek,0
lal 0
loi 4*EM_WSIZE
loc 19
mon
zeq *1
ste errno
#if EM_WSIZE==1
ldc -1
loc 2
loc 4
cii
#endif
#if EM_WSIZE==2
ldc -1
#endif
#if EM_WSIZE==4
loc -1
#endif
1
#if EM_WSIZE==1
ret 4*EM_WSIZE
#endif
#if EM_WSIZE==2
ret 2*EM_WSIZE
#endif
#if EM_WSIZE==4
ret EM_WSIZE
#endif
end

View file

@ -0,0 +1,14 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_open
pro $_open,0
lal 0
loi EM_WSIZE+EM_PSIZE
loc 5
mon
zeq *1
ste errno
loc -1
1
ret EM_WSIZE
end

View file

@ -0,0 +1,8 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_pause
pro $_pause,0
loc 29
mon
ret 0
end

View file

@ -0,0 +1,18 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_pipe
pro $_pipe,0
loc 42
mon
zeq *1
ste errno
loc -1
ret EM_WSIZE
1
lal 0
loi EM_PSIZE
stf EM_WSIZE
sil 0
loc 0
ret EM_WSIZE
end

View file

@ -0,0 +1,23 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_read
pro $_read,0
lol EM_WSIZE+EM_PSIZE
loc EM_WSIZE
loc EM_PSIZE
ciu
lal 0
loi EM_WSIZE+EM_PSIZE
loc 3
mon
zne *1
loc EM_PSIZE
loc EM_WSIZE
cui
bra *2
1
ste errno
loc -1
2
ret EM_WSIZE
end

View file

@ -0,0 +1,60 @@
#
#include <em_abs.h>
mes 2,EM_WSIZE,EM_PSIZE
.1
bss EM_PSIZE,0,0
.2
bss EM_WSIZE,0,0
pro $ctch,0
lol 0
loc EHEAP
beq *1
lae .1
loi EM_PSIZE
sig
asp EM_PSIZE
lol 0
trp
rtt
1
loc 1
ste .2
rtt
end
exp $_sbrk
pro $_sbrk,0
lor 2
lor 2
lpi $ctch
sig
lae .1
sti EM_PSIZE
loc 0
ste .2
lol 0
ads EM_WSIZE ; this is the new heap pointer, but watch out for overflow!
dup EM_PSIZE
lor 2
cmp ; compare with old heap pointer
zlt *1
str 2 ; The - possibly - occurring trap is caught
lae .1
loi EM_PSIZE
sig
asp EM_PSIZE
loe .2
zgt *1
ret EM_PSIZE
1
asp EM_PSIZE
loc -1
loc EM_WSIZE
loc EM_PSIZE
cii
ret EM_PSIZE
end

View file

@ -0,0 +1,16 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_unlink
pro $_unlink,0
lal 0
loi EM_PSIZE
loc 10
mon
zne *1
loc 0
ret EM_WSIZE
1
ste errno
loc -1
ret EM_WSIZE
end

View file

@ -0,0 +1,33 @@
#
mes 2,EM_WSIZE,EM_PSIZE
#if EM_WSIZE<4
#define STATUS_SIZE 2
#else
#define STATUS_SIZE EM_WSIZE
#endif
exp $_wait
pro $_wait,0
loc 7
mon
zne *1
lal 0
loi EM_PSIZE
zer EM_PSIZE
cms EM_PSIZE
zeq *2
#if EM_WSIZE==1
lal 0
loi EM_PSIZE
sti 2 ; 2 bytes, not one int!
#else
sil 0
#endif
ret EM_WSIZE
2
asp STATUS_SIZE
ret EM_WSIZE
1
ste errno
loc -1
ret EM_WSIZE
end

View file

@ -0,0 +1,23 @@
#
mes 2,EM_WSIZE,EM_PSIZE
exp $_write
pro $_write,0
lol EM_WSIZE+EM_PSIZE
loc EM_WSIZE
loc EM_PSIZE
ciu
lal 0
loi EM_WSIZE+EM_PSIZE
loc 4
mon
zne *1
loc EM_PSIZE
loc EM_WSIZE
cui
bra *2
1
ste errno
loc -1
2
ret EM_WSIZE
end

View file

@ -1,5 +1,6 @@
/* $Header$ */ /* $Header$ */
#include <sgtty.h> #include <sgtty.h>
int gtty(fildes,argp) int fildes ; struct sgttyb *argp ; { int
gtty(fildes,argp) int fildes ; struct sgttyb *argp ; {
return ioctl(fildes,TIOCGETP,argp) ; return ioctl(fildes,TIOCGETP,argp) ;
} }

View file

@ -1,5 +1,6 @@
/* $Header$ */ /* $Header$ */
#include <sgtty.h> #include <sgtty.h>
int stty(fildes,argp) int fildes ; struct sgttyb *argp ; { int
stty(fildes,argp) int fildes ; struct sgttyb *argp ; {
return ioctl(fildes,TIOCSETP,argp) ; return ioctl(fildes,TIOCSETP,argp) ;
} }

View file

@ -1,7 +1,8 @@
/* $Header$ */ /* $Header$ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/timeb.h> #include <sys/timeb.h>
time_t time(timpt) time_t *timpt ; { time_t
time(timpt) time_t *timpt ; {
struct timeb buf ; struct timeb buf ;
ftime(&buf) ; ftime(&buf) ;