Browse Source

Added entry points for ANSI C

ceriel 34 years ago
parent
commit
cc24b3e8fd

+ 30 - 7
mach/xenix3/libsys/LIST

@@ -14,13 +14,6 @@ sdget.c
 stime.c
 time.c
 wait.c
-_exit.s
-_pipe.s
-_profil.s
-_sdget.s
-_stime.s
-_time.s
-_wait.s
 access.s
 acct.s
 alarm.s
@@ -85,4 +78,34 @@ ustat.s
 utime.s
 waitsem.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

+ 13 - 0
mach/xenix3/libsys/_Xpipe.s

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

+ 13 - 0
mach/xenix3/libsys/_Xwait.s

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

+ 11 - 0
mach/xenix3/libsys/_alarm.s

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

+ 6 - 0
mach/xenix3/libsys/_brk.s

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

+ 6 - 0
mach/xenix3/libsys/_close.s

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

+ 6 - 0
mach/xenix3/libsys/_dup2.c

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

+ 9 - 0
mach/xenix3/libsys/_execl.c

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

+ 19 - 0
mach/xenix3/libsys/_execve.s

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

+ 20 - 0
mach/xenix3/libsys/_fork.s

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

+ 6 - 0
mach/xenix3/libsys/_fstat.s

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

+ 12 - 0
mach/xenix3/libsys/_ftime.s

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

+ 7 - 0
mach/xenix3/libsys/_getpid.s

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

+ 5 - 0
mach/xenix3/libsys/_gtty.c

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

+ 6 - 0
mach/xenix3/libsys/_ioctl.s

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

+ 6 - 0
mach/xenix3/libsys/_kill.s

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

+ 6 - 0
mach/xenix3/libsys/_link.s

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

+ 25 - 0
mach/xenix3/libsys/_lseek.s

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

+ 6 - 0
mach/xenix3/libsys/_open.s

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

+ 11 - 0
mach/xenix3/libsys/_pause.s

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

+ 14 - 0
mach/xenix3/libsys/_pipe.c

@@ -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 - 0
mach/xenix3/libsys/_read.s

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

+ 22 - 0
mach/xenix3/libsys/_sbrk.s

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

+ 6 - 0
mach/xenix3/libsys/_unlink.s

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

+ 10 - 0
mach/xenix3/libsys/_wait.c

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

+ 6 - 0
mach/xenix3/libsys/_write.s

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

+ 1 - 9
mach/xenix3/libsys/pipe.c

@@ -1,14 +1,6 @@
-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;
+	return _pipe(f);
 }

+ 1 - 7
mach/xenix3/libsys/wait.c

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