Added entry points for ANSI C

This commit is contained in:
ceriel 1990-01-19 17:37:29 +00:00
parent 9eff28dac8
commit 66327ddda6
28 changed files with 289 additions and 23 deletions

View file

@ -14,13 +14,6 @@ sdget.c
stime.c stime.c
time.c time.c
wait.c wait.c
_exit.s
_pipe.s
_profil.s
_sdget.s
_stime.s
_time.s
_wait.s
access.s access.s
acct.s acct.s
alarm.s alarm.s
@ -85,4 +78,34 @@ ustat.s
utime.s utime.s
waitsem.s waitsem.s
write.s write.s
_Xpipe.s
_Xwait.s
_alarm.s
_brk.s
_close.s
_dup2.c
_execl.c
_execve.s
_exit.s
_fork.s
_fstat.s
_ftime.s
_getpid.s
_gtty.c
_ioctl.s
_kill.s
_link.s
_lseek.s
_open.s
_pause.s
_pipe.c
_profil.s
_read.s
_sbrk.s
_sdget.s
_stime.s
_time.s
_unlink.s
_wait.c
_write.s
xdup.s xdup.s

View file

@ -0,0 +1,13 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __Xpipe
.sect .text
__Xpipe:
mov ax,42
call syscal
mov dx,bx
jae 1f
mov (_errno),ax
mov ax,-1
cwd
1:
ret

View file

@ -0,0 +1,13 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __Xwait
.sect .text
__Xwait:
mov ax,7
call syscal
mov dx,bx
jae 1f
mov (_errno),ax
mov ax,-1
cwd
1:
ret

View file

@ -0,0 +1,11 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __alarm
.sect .text
__alarm:
mov ax,27
push bp
mov bp,sp
mov bx,4(bp)
call syscal
pop bp
ret

View file

@ -0,0 +1,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __brk
.sect .text
__brk:
mov ax,17
jmp sysal

View file

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

View file

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

View file

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

View file

@ -0,0 +1,19 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __execve
.sect .text
__execve:
mov ax,59
push bp
mov bp,sp
push si
mov si,8(bp)
mov cx,6(bp)
mov bx,4(bp)
call syscal
pop si
jae 1f
mov (_errno),ax
mov ax,-1
1:
pop bp
ret

View file

@ -0,0 +1,20 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __fork, _par_uid
.sect .bss
.comm _par_uid, 2
.sect .text
__fork:
mov ax,2
call syscal
jb 1f
and bx,bx
je 2f
ret
1:
mov (_errno),ax
mov ax,-1
ret
2:
mov (_par_uid),ax
xor ax,ax
ret

View file

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

View file

@ -0,0 +1,12 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __ftime
.sect .text
__ftime:
mov ax,2856
push bp
mov bp,sp
mov bx,4(bp)
call syscal
pop bp
ret

View file

@ -0,0 +1,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __getpid
.sect .text
__getpid:
mov ax,20
call syscal
ret

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,25 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __lseek
.sect .text
__lseek:
mov ax,19
push bp
mov bp,sp
push si
push di
mov di,10(bp)
mov si,8(bp)
mov cx,6(bp)
mov bx,4(bp)
call syscal
pop di
pop si
pop bp
jae 1f
mov (_errno),ax
mov ax,-1
mov dx,ax
ret
1:
mov dx,bx
ret

View file

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

View file

@ -0,0 +1,11 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __pause
.sect .text
__pause:
mov ax,29
call syscal
jae 1f
mov (_errno),ax
mov ax,-1
1:
ret

View file

@ -0,0 +1,14 @@
long _Xpipe();
int
_pipe(f)
int f[2];
{
long x;
x = _Xpipe();
if (x == -1) return -1;
f[0] = x;
f[1] = x >> 16;
return 0;
}

View file

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

View file

@ -0,0 +1,22 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __sbrk
.sect .text
__sbrk:
push bp
mov bp,sp
push ds
mov ax,4(bp)
cwd
push dx
push ax
mov ax,1
push ax
call __brkctl
add sp,8
pop bp
ret
__brkctl:
mov ax,4904
jmp sysal

View file

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

View file

@ -0,0 +1,10 @@
long _Xwait();
_wait(p)
int *p;
{
long l = _Xwait();
if (l == -1) return -1;
if (p) *p = (l >> 16);
return (int) l;
}

View file

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

View file

@ -1,14 +1,6 @@
long _pipe();
int int
pipe(f) pipe(f)
int f[2]; int f[2];
{ {
long x; return _pipe(f);
x = _pipe();
if (x == -1) return -1;
f[0] = x;
f[1] = x >> 16;
return 0;
} }

View file

@ -1,11 +1,5 @@
long _wait();
wait(p) wait(p)
int *p; int *p;
{ {
long l = _wait(); return _wait(p);
if (l == -1) return -1;
if (p) *p = (l >> 16);
return (int) l;
} }