Преглед изворни кода

added new routines for ansi

eck пре 34 година
родитељ
комит
7cc80df960

+ 23 - 0
mach/m68020/libsys/LIST

@@ -6,53 +6,76 @@ _exit.s
 access.s
 acct.s
 alarm.s
+_alarm.s
 chdir.s
 chmod.s
 chown.s
 chroot.s
 close.s
+_close.s
 creat.s
 dup.s
 dup2.s
+_dup2.s
 execl.s
+_execl.s
 execve.s
+_execve.s
 fork.s
+_fork.s
 ftime.s
+_ftime.s
 getegid.s
 getgid.s
 getpid.s
+_getpid.s
 getuid.s
 stty.s
 gtty.s
+_gtty.s
 ioctl.s
+_ioctl.s
 kill.s
+_kill.s
 link.s
+_link.s
 lock.s
 lseek.s
+_lseek.s
 mknod.s
 mount.s
 nice.s
 open.s
+_open.s
 pause.s
+_pause.s
 pipe.s
+_pipe.s
 profil.s
 ptrace.s
 read.s
+_read.s
 setgid.s
 setuid.s
 Xstat.c
+_Xstat.c
 stat.s
 stime.s
 sync.s
 time.s
 times.s
+_times.s
 umask.s
 umount.s
 unlink.s
+_unlink.s
 utime.s
 write.s
+_write.s
 brk.s
+_brk.s
 wait.s
+_wait.s
 fstat.s
 signal.s
 fcntl.s

+ 1 - 1
mach/m68020/libsys/Xstat.c

@@ -24,7 +24,7 @@ fstat(fd, buf)
 	char Xbuf[100];
 	int retval;
 
-	retval = _fstat(fd, Xbuf);
+	retval = __fstat(fd, Xbuf);
 	Xcvt(Xbuf, (char *)buf);
 	return retval;
 }

+ 30 - 0
mach/m68020/libsys/_Xstat.c

@@ -0,0 +1,30 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+
+static	Xcvt();
+
+int
+_fstat(fd, buf)
+	int fd;
+	struct stat *buf;
+{
+	char Xbuf[100];
+	int retval;
+
+	retval = __fstat(fd, Xbuf);
+	Xcvt(Xbuf, (char *)buf);
+	return retval;
+}
+
+static
+Xcvt(buf, statbuf)
+	char *buf, *statbuf;
+{
+	register char *s, *t;
+	register int i;
+
+	s = buf; t = statbuf;
+	for (i = 14; i; i--) *t++ = *s++;
+	*t++ = 0; *t++ = 0;
+	for (i = 16; i; i--) *t++ = *s++;
+}

+ 10 - 0
mach/m68020/libsys/_alarm.s

@@ -0,0 +1,10 @@
+.define __alarm
+.extern __alarm
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__alarm:		move.l #0x1B,d0
+		trap #0
+		rts

+ 25 - 0
mach/m68020/libsys/_brk.s

@@ -0,0 +1,25 @@
+.define __brk
+.define __sbrk
+.extern __brk
+.extern __sbrk
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__sbrk:		move.l (.reghp),d0
+		add.l  d0,(4,sp)
+		move.l #0x11,d0
+		trap #0
+		bcs lcerror
+		move.l (.reghp),d0
+		move.l d0,a0
+		move.l (4,sp),(.reghp)
+		rts
+lcerror:	jmp (cerror)
+__brk:		move.l #0x11,d0
+		trap #0
+		bcs lcerror
+		move.l (4,sp),(.reghp)
+		clr.l d0
+		rts

+ 9 - 0
mach/m68020/libsys/_close.s

@@ -0,0 +1,9 @@
+.define __close
+.extern __close
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__close:		move.l #0x6,d0
+		jmp (callc)

+ 16 - 0
mach/m68020/libsys/_dup2.s

@@ -0,0 +1,16 @@
+.define __dup2
+.extern __dup2
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__dup2:
+link	a6,#0
+move.l (12,a6),-(sp)
+move.l #0,-(sp)
+move.l (8,a6),-(sp)
+jsr (_fcntl)
+add.l #12,sp
+unlk a6
+rts

+ 15 - 0
mach/m68020/libsys/_execl.s

@@ -0,0 +1,15 @@
+.define __execl
+.extern __execl
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__execl:		link a6,#0
+		move.l (_environ),-(sp)
+		pea (12,a6)
+		move.l (8,a6),-(sp)
+		jsr (_execve)
+		add.l #0xC,sp
+		unlk a6
+		rts

+ 9 - 0
mach/m68020/libsys/_execve.s

@@ -0,0 +1,9 @@
+.define __execve
+.extern __execve
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__execve:	move.l #0x3B,d0
+		jmp (calle)

+ 17 - 0
mach/m68020/libsys/_fork.s

@@ -0,0 +1,17 @@
+.define __fork
+.extern __fork
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__fork:		move.l #0x2,d0
+		trap #0
+		bcc 1f		! 68020 way to do it
+		jmp (cerror)
+1:
+		tst.b d1
+		beq 2f
+		clr.l d0
+2:
+		rts

+ 9 - 0
mach/m68020/libsys/_ftime.s

@@ -0,0 +1,9 @@
+.define __ftime
+.extern __ftime
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__ftime:		move.l #0x23,d0
+		jmp (callc)

+ 10 - 0
mach/m68020/libsys/_getpid.s

@@ -0,0 +1,10 @@
+.define __getpid
+.extern __getpid
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__getpid:	move.l #0x14,d0
+		trap #0
+		rts

+ 9 - 0
mach/m68020/libsys/_gtty.s

@@ -0,0 +1,9 @@
+.define __gtty
+.extern __gtty
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__gtty:		move.l #0x20, d0
+		jmp (call)

+ 9 - 0
mach/m68020/libsys/_ioctl.s

@@ -0,0 +1,9 @@
+.define __ioctl
+.extern __ioctl
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__ioctl:		move.l #0x36,d0
+		jmp (call)

+ 9 - 0
mach/m68020/libsys/_kill.s

@@ -0,0 +1,9 @@
+.define __kill
+.extern __kill
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__kill:		move.l #0x25,d0
+		jmp (callc)

+ 9 - 0
mach/m68020/libsys/_link.s

@@ -0,0 +1,9 @@
+.define __link
+.extern __link
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__link:		move.l #0x9,d0
+		jmp (callc)

+ 9 - 0
mach/m68020/libsys/_lseek.s

@@ -0,0 +1,9 @@
+.define __lseek
+.extern __lseek
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__lseek:		move.l #0x13,d0
+		jmp (call)

+ 9 - 0
mach/m68020/libsys/_open.s

@@ -0,0 +1,9 @@
+.define __open
+.extern __open
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__open:		move.l #0x5,d0
+		jmp (call)

+ 9 - 0
mach/m68020/libsys/_pause.s

@@ -0,0 +1,9 @@
+.define __pause
+.extern __pause
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__pause:		move.l #0x1D,d0
+		jmp (callc)

+ 18 - 0
mach/m68020/libsys/_pipe.s

@@ -0,0 +1,18 @@
+.define __pipe
+.extern __pipe
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__pipe:		
+		move.l #0x2A,d0
+		trap #0
+		bcc 1f
+		jmp (cerror)
+1:
+		move.l (4,sp),a0
+		move.l d0,(a0)+
+		move.l d1,(a0)
+		clr.l d0
+		rts

+ 9 - 0
mach/m68020/libsys/_read.s

@@ -0,0 +1,9 @@
+.define __read
+.extern __read
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__read:		move.l #0x3,d0
+		jmp (call)

+ 10 - 0
mach/m68020/libsys/_times.s

@@ -0,0 +1,10 @@
+.define __times
+.extern __times
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__times:		move.l #0x2B,d0
+		trap #0
+		jmp (call)

+ 9 - 0
mach/m68020/libsys/_unlink.s

@@ -0,0 +1,9 @@
+.define __unlink
+.extern __unlink
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__unlink:	move.l #0xA,d0
+		jmp (callc)

+ 15 - 0
mach/m68020/libsys/_wait.s

@@ -0,0 +1,15 @@
+.define __wait
+.extern __wait
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__wait:		move.l	#0x7,d0
+		trap #0
+		bcs cerror
+		tst.l (4,sp)
+		beq 1f
+		move.l d1,([4,sp])
+1:
+		rts

+ 9 - 0
mach/m68020/libsys/_write.s

@@ -0,0 +1,9 @@
+.define __write
+.extern __write
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__write:		move.l #0x4,d0
+		jmp (call)

+ 3 - 3
mach/m68020/libsys/fstat.s

@@ -1,9 +1,9 @@
-.define __fstat
-.extern __fstat
+.define ___fstat
+.extern ___fstat
 .sect .text
 .sect .rom
 .sect .data
 .sect .bss
 .sect .text
-__fstat:	move.l	#0x1C,d0
+___fstat:	move.l	#0x1C,d0
 		jmp (callc)