Added entry points for ANSI C

This commit is contained in:
ceriel 1990-01-22 11:01:47 +00:00
parent 69e2ddcb49
commit 67f0c95888
36 changed files with 287 additions and 14 deletions

View file

@ -13,12 +13,11 @@ profil.c
stime.c
time.c
wait.c
_exit.s
_pipe.s
_profil.s
_stime.s
_time.s
_wait.s
xwait.s
xpipe.s
xprofil.s
xstime.s
xtime.s
access.s
acct.s
alarm.s
@ -67,3 +66,29 @@ unlink.s
utime.s
write.s
xdup.s
_alarm.s
_brk.s
_close.s
_creat.s
_dup.c
_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
_read.s
_sbrk.s
_unlink.s
_wait.c
_write.s

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

View file

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

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

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,7 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __execve
.sect .text
__execve:
mov ax,59
callf 0x7:0x0
jmp cerror

15
mach/i386/libsys/_fork.s Normal file
View file

@ -0,0 +1,15 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __fork
.sect .text
__fork:
mov ax,2
callf 0x7:0x0
jb 1f
and dx,dx
jne 2f
ret
1:
jmp cerror
2:
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 sysx

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,6 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __getpid
.sect .text
__getpid:
mov ax,20
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,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

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/_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

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

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 __unlink
.sect .text
__unlink:
mov ax,10
jmp sysx

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

@ -0,0 +1,11 @@
long _xwait();
_wait(p)
int *p;
{
long l = _xwait();
if (l == -1) return -1;
if (p) *p = (l >> 16);
return l & 0xffff;
}

View file

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

View file

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

View file

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

View file

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

View file

@ -1,10 +1,10 @@
long _time();
long _xtime();
long
time(p)
long *p;
{
long l = _time();
long l = _xtime();
if (p) *p = l;
return l;

View file

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

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

@ -0,0 +1,12 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __xpipe
.sect .text
__xpipe:
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 __xprofil
.sect .text
__xprofil:
mov ax,44
jmp syscal

View file

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

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

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

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

@ -0,0 +1,12 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __xwait
.sect .text
__xwait:
mov ax,7
callf 0x7:0x0
jb 1f
shl dx,0x10
or eax,edx
ret
1:
jmp cerror