ceriel преди 37 години
родител
ревизия
88da4849b4
променени са 100 файла, в които са добавени 1923 реда и са изтрити 0 реда
  1. 560 0
      mach/sun2/cv/cv.c
  2. 6 0
      mach/sun3/Action
  3. 25 0
      mach/sun3/cv/Makefile
  4. 560 0
      mach/sun3/cv/cv.c
  5. 159 0
      mach/sun3/libsys/LIST
  6. 29 0
      mach/sun3/libsys/Makefile
  7. 7 0
      mach/sun3/libsys/_exit.s
  8. 4 0
      mach/sun3/libsys/accept.s
  9. 4 0
      mach/sun3/libsys/access.s
  10. 4 0
      mach/sun3/libsys/acct.s
  11. 4 0
      mach/sun3/libsys/adjtime.s
  12. 13 0
      mach/sun3/libsys/alarm.c
  13. 4 0
      mach/sun3/libsys/async_dem.s
  14. 4 0
      mach/sun3/libsys/bind.s
  15. 9 0
      mach/sun3/libsys/cerror.s
  16. 4 0
      mach/sun3/libsys/chdir.s
  17. 4 0
      mach/sun3/libsys/chmod.s
  18. 4 0
      mach/sun3/libsys/chown.s
  19. 4 0
      mach/sun3/libsys/chroot.s
  20. 1 0
      mach/sun3/libsys/cleanup.c
  21. 4 0
      mach/sun3/libsys/close.s
  22. 4 0
      mach/sun3/libsys/compmodule
  23. 4 0
      mach/sun3/libsys/connect.s
  24. 4 0
      mach/sun3/libsys/creat.s
  25. 4 0
      mach/sun3/libsys/dup.s
  26. 4 0
      mach/sun3/libsys/dup2.s
  27. 8 0
      mach/sun3/libsys/execl.c
  28. 9 0
      mach/sun3/libsys/execle.c
  29. 7 0
      mach/sun3/libsys/execv.c
  30. 4 0
      mach/sun3/libsys/execve.s
  31. 5 0
      mach/sun3/libsys/exit.c
  32. 4 0
      mach/sun3/libsys/exportfs.s
  33. 4 0
      mach/sun3/libsys/fchmod.s
  34. 4 0
      mach/sun3/libsys/fchown.s
  35. 4 0
      mach/sun3/libsys/fcntl.s
  36. 4 0
      mach/sun3/libsys/flock.s
  37. 14 0
      mach/sun3/libsys/fork.s
  38. 4 0
      mach/sun3/libsys/fstat.s
  39. 4 0
      mach/sun3/libsys/fstatfs.s
  40. 4 0
      mach/sun3/libsys/fsync.s
  41. 15 0
      mach/sun3/libsys/ftime.c
  42. 4 0
      mach/sun3/libsys/ftruncate.s
  43. 4 0
      mach/sun3/libsys/getdirent.s
  44. 4 0
      mach/sun3/libsys/getdomnam.s
  45. 4 0
      mach/sun3/libsys/getdopt.s
  46. 4 0
      mach/sun3/libsys/getdtabsz.s
  47. 8 0
      mach/sun3/libsys/getegid.s
  48. 8 0
      mach/sun3/libsys/geteuid.s
  49. 4 0
      mach/sun3/libsys/getfh.s
  50. 4 0
      mach/sun3/libsys/getgid.s
  51. 4 0
      mach/sun3/libsys/getgroups.s
  52. 4 0
      mach/sun3/libsys/gethostid.s
  53. 4 0
      mach/sun3/libsys/gethostnam.s
  54. 4 0
      mach/sun3/libsys/getitimer.s
  55. 4 0
      mach/sun3/libsys/getpagesiz.s
  56. 4 0
      mach/sun3/libsys/getpeernam.s
  57. 4 0
      mach/sun3/libsys/getpgrp.s
  58. 4 0
      mach/sun3/libsys/getpid.s
  59. 8 0
      mach/sun3/libsys/getppid.s
  60. 4 0
      mach/sun3/libsys/getprio.s
  61. 4 0
      mach/sun3/libsys/getrlimit.s
  62. 4 0
      mach/sun3/libsys/getrusage.s
  63. 4 0
      mach/sun3/libsys/getsocknam.s
  64. 4 0
      mach/sun3/libsys/getsockopt.s
  65. 4 0
      mach/sun3/libsys/gettimday.s
  66. 4 0
      mach/sun3/libsys/getuid.s
  67. 7 0
      mach/sun3/libsys/gtty.c
  68. 65 0
      mach/sun3/libsys/head_em.s
  69. 4 0
      mach/sun3/libsys/ioctl.s
  70. 4 0
      mach/sun3/libsys/kill.s
  71. 4 0
      mach/sun3/libsys/killpg.s
  72. 4 0
      mach/sun3/libsys/link.s
  73. 4 0
      mach/sun3/libsys/listen.s
  74. 43 0
      mach/sun3/libsys/lockf.c
  75. 4 0
      mach/sun3/libsys/lseek.s
  76. 4 0
      mach/sun3/libsys/lstat.s
  77. 4 0
      mach/sun3/libsys/madvise.s
  78. 4 0
      mach/sun3/libsys/mincore.s
  79. 4 0
      mach/sun3/libsys/mkdir.s
  80. 4 0
      mach/sun3/libsys/mknod.s
  81. 4 0
      mach/sun3/libsys/mmap.s
  82. 4 0
      mach/sun3/libsys/mount.s
  83. 4 0
      mach/sun3/libsys/mprotect.s
  84. 4 0
      mach/sun3/libsys/mremap.s
  85. 18 0
      mach/sun3/libsys/msg.s
  86. 4 0
      mach/sun3/libsys/msgsys.s
  87. 4 0
      mach/sun3/libsys/munmap.s
  88. 4 0
      mach/sun3/libsys/nfssvc.s
  89. 13 0
      mach/sun3/libsys/nice.c
  90. 4 0
      mach/sun3/libsys/open.s
  91. 3 0
      mach/sun3/libsys/pause.c
  92. 14 0
      mach/sun3/libsys/pipe.s
  93. 8 0
      mach/sun3/libsys/plock.c
  94. 4 0
      mach/sun3/libsys/profil.s
  95. 7 0
      mach/sun3/libsys/ptrace.s
  96. 4 0
      mach/sun3/libsys/quotactl.s
  97. 4 0
      mach/sun3/libsys/read.s
  98. 4 0
      mach/sun3/libsys/readlink.s
  99. 4 0
      mach/sun3/libsys/readv.s
  100. 10 0
      mach/sun3/libsys/reboot.s

+ 560 - 0
mach/sun2/cv/cv.c

@@ -0,0 +1,560 @@
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ *          This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ *      Dr. Andrew S. Tanenbaum
+ *      Wiskundig Seminarium
+ *      Vrije Universiteit
+ *      Postbox 7161
+ *      1007 MC Amsterdam
+ *      The Netherlands
+ *
+ */
+
+/*
+ * Convert ACK a.out file to SUN3 object format.
+ */
+
+#include <stdio.h>
+#include <out.h>
+#include <assert.h>
+
+long	lseek();
+
+#define	OMAGIC	0407	/* old-fashioned */
+#define	NMAGIC	0410	/* text write protexted */
+#define ZMAGIC	0413	/* demand paging */
+
+#define MACH	2
+
+struct bhdr {
+	short	machtype;
+	short	magic;
+	long	tsize;
+	long	dsize;
+	long	bsize;
+	long	ssize;
+	long	entry;
+	long	rtsize;
+	long	rdsize;
+};
+
+struct machrelo {
+	long	address;
+	long	relodata;
+};
+#define setpcrel(X,f)	(X |= (f<<7))
+#define setsymbolnum(X,n)	(X = (X & 0377) | ((long)n << 8))
+#define setextern(X,f)	(X |= (f << 4))
+#define setlength(X,l)	(X = (X & ~0x60)|((long) l << 5))
+
+struct sym {
+	long	name;
+	char	type;
+	char	other;
+	short	desc;
+	long	value;
+};
+
+#define N_UNDF	0
+#define	N_ABS	02
+#define	N_TEXT	04
+#define	N_DATA	06
+#define	N_BSS	010
+#define	N_EXT	01
+#define N_FN	0x1f
+
+/*
+ * Header and section table of new format object file.
+ */
+struct outhead	outhead;
+struct outsect	outsect[S_MAX];
+
+char	*output_file;
+int	outputfile_created;
+long magic;
+
+int rom_in_data;
+
+char *program ;
+
+char flag ;
+
+/* Output file definitions and such */
+
+struct bhdr bh;
+
+#define ENTRY 0x02000
+#define TOT_HDRSIZE	(sizeof(struct bhdr))
+
+
+
+#define TEXTSG	0
+#define ROMSG	1
+#define DATASG	2
+#define BSSSG	3
+#define LSECT	BSSSG+1
+#define NSECT	LSECT+1
+
+int		output;
+
+int unresolved;
+long	textsize ; 
+long	datasize ;
+long	bsssize;
+
+main(argc, argv)
+	int	argc;
+	char	*argv[];
+{
+	register int		nsect;
+
+	program= argv[0] ;
+	if ( argc>1 && argv[1][0]=='-' ) {
+		flag=argv[1][1] ;
+		argc-- ; argv++ ;
+	}
+	switch (argc) {
+	case 3:	if ((output = creat(argv[2], 0644)) < 0 ||
+		    (close(output), output = open(argv[2],2)) < 0)
+			fatal("Can't write %s.\n", argv[2]);
+		output_file = argv[2];
+		outputfile_created = 1;
+		if (! rd_open(argv[1]))
+			fatal("Can't read %s.\n", argv[1]);
+		break;
+	default:fatal("Usage: %s <ACK object> <Sun object>.\n", argv[0]);
+	}
+	rd_ohead(&outhead);
+	if (BADMAGIC(outhead))
+		fatal("Not an ack object file.\n");
+	if (outhead.oh_flags & HF_LINK) {
+		unresolved++;
+		fprintf(stderr,"Warning: contains unresolved references.\n");
+	}
+	else if (outhead.oh_nrelo > 0)
+		fprintf(stderr, "Warning: relocation information present.\n");
+	if ( outhead.oh_nsect!=LSECT && outhead.oh_nsect!=NSECT )
+		fatal("Input file must have %d sections, not %ld\n",
+			NSECT,outhead.oh_nsect) ;
+	rd_sect(outsect, outhead.oh_nsect);
+	/* A few checks */
+	if ( outsect[BSSSG].os_flen != 0 )
+		fatal("bss space contains initialized data\n") ;
+	if ( !unresolved && outsect[BSSSG].os_base != outsect[DATASG].os_base+
+					outsect[DATASG].os_size )
+		fatal("bss segment must follow data segment\n") ;
+	if ( outsect[ROMSG].os_lign == 0x20000 ) {
+		/* 410/413 file with ROMSG in data space */
+		rom_in_data = 1;
+		magic= NMAGIC ;
+		textsize= outsect[TEXTSG].os_size ;
+		datasize= outsect[ROMSG].os_size + outsect[DATASG].os_size ;
+		if ( outsect[DATASG].os_base != outsect[ROMSG].os_base+
+						outsect[ROMSG].os_size )
+			fatal("data segment must follow rom\n") ;
+	} else
+	if ( outsect[DATASG].os_lign == 0x20000 ) {
+		/* 410/413 file with ROMSG in instruction space */
+		rom_in_data = 0;
+		magic= NMAGIC ;
+		textsize= outsect[TEXTSG].os_size + outsect[ROMSG].os_size ;
+		datasize= outsect[DATASG].os_size ;
+		if ( outsect[ROMSG].os_base != outsect[TEXTSG].os_base+
+						outsect[TEXTSG].os_size )
+			fatal("rom segment must follow text\n") ;
+	} else {
+		/* Plain 407 file */
+		rom_in_data = 0;
+		magic= OMAGIC ;
+		textsize= outsect[TEXTSG].os_size + outsect[ROMSG].os_size ;
+		datasize= outsect[DATASG].os_size ;
+		if (!unresolved) {
+			if (outsect[ROMSG].os_base != outsect[TEXTSG].os_base+
+						outsect[TEXTSG].os_size )
+				fatal("rom segment must follow text\n") ;
+			if ( outsect[DATASG].os_base != outsect[ROMSG].os_base+
+						outsect[ROMSG].os_size )
+				fatal("data segment must follow rom\n") ;
+		}
+	}
+	if (outsect[TEXTSG].os_base == TOT_HDRSIZE+ENTRY) {
+		if (magic != NMAGIC) {
+			fatal("illegal alignments.\n");
+		}
+		magic = ZMAGIC;
+		textsize = (textsize + TOT_HDRSIZE + (0x2000 - 1)) & ~(0x2000 - 1);
+		datasize = (datasize + (0x2000 - 1)) & ~(0x2000 - 1);
+	}
+	bsssize = outsect[BSSSG].os_size;
+	if ( outhead.oh_nsect==NSECT ) {
+		if ( outsect[LSECT].os_base != outsect[BSSSG].os_base+
+						outsect[BSSSG].os_size )
+			fatal("end segment must follow bss\n") ;
+		if ( outsect[LSECT].os_size != 0 )
+			fatal("end segment must be empty\n") ;
+	}
+
+	if (magic != OMAGIC && unresolved) {
+		fatal("unresolved references with wrong magic number\n");
+	}
+
+	if ((magic == ZMAGIC && outsect[TEXTSG].os_base != TOT_HDRSIZE+ENTRY) ||
+	    (magic != ZMAGIC && !unresolved && outsect[TEXTSG].os_base != ENTRY)) {
+		fatal("Illegal entry point.\n");
+	}
+
+	bh.magic = magic;
+	bh.machtype = MACH;
+	bh.tsize = textsize;
+	bh.bsize = bsssize;
+	bh.dsize = datasize;
+	bh.rtsize = 0;
+	bh.rdsize = 0;
+	if (magic == ZMAGIC) bh.entry = TOT_HDRSIZE+ENTRY;
+	else if (!unresolved)	bh.entry = ENTRY;
+	else bh.entry = 0;
+
+	/* Action at last */
+	lseek(output,(long) TOT_HDRSIZE,0);
+	emits(&outsect[TEXTSG]) ;
+	if (rom_in_data && magic == ZMAGIC) {
+		lseek(output,textsize,0);
+	}
+	emits(&outsect[ROMSG]) ;
+	if (!rom_in_data && magic == ZMAGIC) {
+		lseek(output,textsize,0);
+	}
+	emits(&outsect[DATASG]) ;
+	if (magic == ZMAGIC) {
+		lseek(output,textsize + datasize,0);
+	}
+	if (unresolved) emit_relo();
+	emit_symtab();
+	bh.ssize = outhead.oh_nname * sizeof(struct sym);
+	lseek(output,0L,0);
+	cvshort(&(bh.machtype));
+	cvshort(&(bh.magic));
+	cvlong(&(bh.tsize));
+	cvlong(&(bh.dsize));
+	cvlong(&(bh.bsize));
+	cvlong(&(bh.ssize));
+	cvlong(&(bh.entry));
+	cvlong(&(bh.rtsize));
+	cvlong(&(bh.rdsize));
+	writef(&bh, 1, (long) TOT_HDRSIZE);
+	if ( outputfile_created  && !unresolved ) chmod(argv[2],0755);
+	return 0;
+}
+
+writef(addr,sz,cnt)
+	char *addr;
+	long cnt;
+{
+	cnt *= sz;
+
+	while (cnt) {
+		int i = cnt >= 0x4000 ? 0x4000 : cnt;
+
+		cnt -= i;
+		if (write(output, addr, i) < i) {
+			fatal("write error\n");
+		}
+		addr += i;
+	}
+}
+
+/*
+ * Transfer the emitted byted from one file to another.
+ */
+emits(section) struct outsect *section ; {
+	char		*p;
+	char		*calloc();
+	long sz = section->os_flen;
+
+	rd_outsect(section - outsect);
+	while (sz) {
+		unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
+		if (!(p = calloc(i, 1))) {
+			fatal("No memory.\n");
+		}
+		rd_emit(p, i);
+		if (write(output, p, i) < i) {
+			fatal("write error.\n");
+		}
+		free(p);
+		sz -= i;
+	}
+
+	sz = section->os_size - section->os_flen;
+	while (sz) {
+		unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
+		if (!(p = calloc(i, 1))) {
+			fatal("No memory.\n");
+		}
+		if (write(output, p, i) < i) {
+			fatal("write error.\n");
+		}
+		free(p);
+		sz -= i;
+	}
+}
+
+struct outname *ACKnames;
+
+emit_relo()
+{
+	struct outrelo *ACKrelo;
+	struct machrelo *MACHtrelo,*MACHdrelo;
+	register struct outrelo *ap;
+	register struct machrelo *mtp, *mdp;
+	unsigned int cnt = outhead.oh_nrelo;
+
+	ACKrelo = (struct outrelo *) calloc(cnt, sizeof(struct outrelo));
+	MACHtrelo = (struct machrelo *) calloc(cnt, sizeof(struct machrelo));
+	MACHdrelo = (struct machrelo *) calloc(cnt, sizeof(struct machrelo));
+	ACKnames = (struct outname *) calloc(outhead.oh_nname, sizeof(struct outname));
+	if (!(ap = ACKrelo) || !(mtp = MACHtrelo) || !(mdp = MACHdrelo) ||
+	    !ACKnames) {
+		fatal("No memory.\n");
+	}
+	rd_relo(ACKrelo, cnt);
+	rd_name(ACKnames, outhead.oh_nname);
+	while (cnt-- != 0) {
+		register struct machrelo *mp;
+
+		if (ap->or_sect - S_MIN <= ROMSG) mp = mtp++;
+		else mp = mdp++;
+		setlength(mp->relodata,(ap->or_type&RELSZ) >> 1);
+		setpcrel(mp->relodata,(ap->or_type&RELPC != 0));
+		mp->address = ap->or_addr;
+		if (ap->or_sect == ROMSG+S_MIN) {
+			mp->address += outsect[TEXTSG].os_size;
+		}
+		if (ap->or_nami < outhead.oh_nname) {
+			if (ACKnames[ap->or_nami].on_type & S_EXT) {
+				setsymbolnum(mp->relodata, ap->or_nami);
+				setextern(mp->relodata,1);
+			}
+			else {
+				patch(ap, &ACKnames[ap->or_nami], mp);
+			}
+		}
+		else {
+			setsymbolnum(mp->relodata, N_ABS);
+		}
+		cvlong(&(mp->address));
+		cvlong(&(mp->relodata));
+		ap++;
+	}
+	bh.rtsize = (char *) mtp - (char *) MACHtrelo;
+	bh.rdsize = (char *) mdp - (char *) MACHdrelo;
+	writef(MACHtrelo, 1, bh.rtsize);
+	writef(MACHdrelo, 1, bh.rdsize);
+	free(ACKrelo);
+	free(MACHtrelo);
+	free(MACHdrelo);
+}
+
+long
+get(sz)
+{
+	char buf[10];
+	long l = 0;
+	register char *p = buf;
+
+	read(output,buf,sz);
+	while (sz--) {
+		l = (l << 8) | (*p++ & 0377);
+	}
+}
+
+put(l,sz)
+	long l;
+{
+	char buf[10];
+	register char *p;
+
+	*p++ = l >> 24;
+	*p++ = l >> 16;
+	*p++ = l >> 8;
+	*p++ = l;
+	p -= sz;
+	if (write(output, p, sz) < sz) {
+		fatal("write error.\n");
+	}
+}
+
+patch(ap, an, mp)
+	register struct outrelo *ap;
+	register struct outname *an;
+	register struct machrelo *mp;
+{
+	int whichsect = (an->on_type & S_TYP) - S_MIN;
+	long correction = 0;
+	long where = TOT_HDRSIZE+ap->or_addr;
+	long X;
+	long here;
+	int sz;
+
+	if (!(an->on_type & S_SCT)) {
+		fprintf(stderr,"funny on_type %x\n", an->on_type);
+	}
+	switch(whichsect) {
+	case TEXTSG:
+		setsymbolnum(mp->relodata,N_TEXT);
+		return;
+	case DATASG:
+		correction = outsect[ROMSG].os_size + outsect[TEXTSG].os_size;
+		setsymbolnum(mp->relodata,N_DATA);
+		break;
+	case ROMSG:
+		correction += outsect[TEXTSG].os_size;
+		setsymbolnum(mp->relodata,N_TEXT);
+		break;
+	default:
+		assert(0);
+	}
+
+	switch(ap->or_sect - S_MIN) {
+	case DATASG:
+		where += outsect[ROMSG].os_size;
+	case ROMSG:
+		where += outsect[TEXTSG].os_size;
+	case TEXTSG:
+		break;
+	default:
+		assert(0);
+	}
+	here = lseek(output, 0L, 1);
+	lseek(output, where, 0);
+	sz = ap->or_type & RELSZ;
+	X = get(sz) + correction;
+	lseek(output, where, 0);
+	put(X,sz);
+	lseek(output, here, 0);
+}
+
+cvlong(l)
+	long *l;
+{
+	long x = *l;
+	char *p = (char *) l;
+
+	*p++ = x >> 24;
+	*p++ = x >> 16;
+	*p++ = x >> 8;
+	*p = x;
+}
+
+cvshort(s)
+	short *s;
+{
+	short x = *s;
+	char *p = (char *) s;
+
+	*p++ = x >> 8;
+	*p = x;
+}
+
+emit_symtab()
+{
+	register unsigned short i = outhead.oh_nname;
+	register struct outname *A;
+	struct sym *MACHnames;
+	register struct sym *M;
+	extern char *malloc(), *calloc();
+	char *chars;
+	long offX = OFF_CHAR(outhead) - 4;
+
+	if (!(A = ACKnames)) {
+	    	if (!(A = (struct outname *)
+			calloc(i, sizeof(struct outname)))) {
+			fatal("No memory.\n");
+		}
+		rd_name(A, outhead.oh_nname);
+	}
+	if (!(M = (struct sym *) calloc(i, sizeof(struct sym)))) {
+		fatal("No memory.\n");
+	}
+	MACHnames = M;
+	ACKnames = A;
+	for (; i; i--, A++, M++) {
+		M->value = A->on_valu;
+		switch(A->on_type & S_TYP) {
+			case S_UND:
+				M->type = N_UNDF;
+				break;
+			case S_ABS:
+				M->type = N_ABS;
+				break;
+			case S_MIN + TEXTSG:
+				if (! A->on_type & S_COM) {
+					M->value += outsect[TEXTSG].os_base;
+				}
+				M->type = N_TEXT; 
+				break;
+			case S_MIN + ROMSG:
+				M->type = (rom_in_data ? N_DATA : N_TEXT);
+				if (! A->on_type & S_COM) {
+					M->value += outsect[ROMSG].os_base;
+				}
+				break;
+			case S_MIN + DATASG:
+				M->type = N_DATA;
+				if (! A->on_type & S_COM) {
+					M->value += outsect[DATASG].os_base;
+				}
+				break;
+			case S_MIN + BSSSG:
+				M->type = N_BSS;
+				if (! A->on_type & S_COM) {
+					M->value += outsect[BSSSG].os_base;
+				}
+				break;
+			case S_MIN + LSECT:
+				M->type = N_BSS;
+				if (! A->on_type & S_COM) {
+					M->value += outsect[LSECT].os_base;
+				}
+				break;
+			default:
+				fprintf(stderr,"warning: unknown s_type: %d\n",
+					A->on_type & S_TYP);
+		}
+		if (A->on_type & S_EXT) M->type |= N_EXT;
+		if (M->name = A->on_foff) {
+			M->name -= offX;
+		}
+		cvlong(&(M->name));
+		cvlong(&(M->value));
+	}
+	writef(MACHnames, sizeof(struct sym), (long) outhead.oh_nname);
+	free(MACHnames);
+	free(ACKnames);
+	if ((unsigned) outhead.oh_nchar != outhead.oh_nchar ||
+	    !( chars = malloc((unsigned) outhead.oh_nchar))) {
+		fatal("No memory\n.");
+	}
+	put(outhead.oh_nchar+4,4);
+	rd_string(chars,outhead.oh_nchar);
+	writef(chars, 1, outhead.oh_nchar);
+	free(chars);
+}
+
+/* VARARGS1 */
+fatal(s, a1, a2)
+	char	*s;
+{
+	fprintf(stderr,"%s: ",program) ;
+	fprintf(stderr, s, a1, a2);
+	if (outputfile_created)
+		unlink(output_file);
+	exit(-1);
+}
+
+rd_fatal() { fatal("read error.\n"); }

+ 6 - 0
mach/sun3/Action

@@ -0,0 +1,6 @@
+name "Ack.out --> SUN 68020 a.out format conversion program"
+dir cv
+end
+name "SUN 68020 systemcall library"
+dir libsys
+end

+ 25 - 0
mach/sun3/cv/Makefile

@@ -0,0 +1,25 @@
+EMHOME =	../../..
+LIBOBJ =	$(EMHOME)/modules/lib/libobject.a
+INCLUDE =	$(EMHOME)/h
+CFLAGS =	-I. -I$(INCLUDE) -O
+TARGETS =	cv
+
+all:		$(TARGETS)
+
+install:	all
+		../../install cv
+
+cmp:		all
+		../../compare cv
+
+cv:	cv.o
+		$(CC) $(LDFLAGS) -o cv cv.o $(LIBOBJ)
+
+clean:
+		rm -f $(TARGETS) *.o nohup.out Out
+
+pr:
+		@pr Makefile cv.c
+
+opr:
+		make pr | opr

+ 560 - 0
mach/sun3/cv/cv.c

@@ -0,0 +1,560 @@
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ *          This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ *      Dr. Andrew S. Tanenbaum
+ *      Wiskundig Seminarium
+ *      Vrije Universiteit
+ *      Postbox 7161
+ *      1007 MC Amsterdam
+ *      The Netherlands
+ *
+ */
+
+/*
+ * Convert ACK a.out file to SUN3 object format.
+ */
+
+#include <stdio.h>
+#include <out.h>
+#include <assert.h>
+
+long	lseek();
+
+#define	OMAGIC	0407	/* old-fashioned */
+#define	NMAGIC	0410	/* text write protexted */
+#define ZMAGIC	0413	/* demand paging */
+
+#define MACH	2
+
+struct bhdr {
+	short	machtype;
+	short	magic;
+	long	tsize;
+	long	dsize;
+	long	bsize;
+	long	ssize;
+	long	entry;
+	long	rtsize;
+	long	rdsize;
+};
+
+struct machrelo {
+	long	address;
+	long	relodata;
+};
+#define setpcrel(X,f)	(X |= (f<<7))
+#define setsymbolnum(X,n)	(X = (X & 0377) | ((long)n << 8))
+#define setextern(X,f)	(X |= (f << 4))
+#define setlength(X,l)	(X = (X & ~0x60)|((long) l << 5))
+
+struct sym {
+	long	name;
+	char	type;
+	char	other;
+	short	desc;
+	long	value;
+};
+
+#define N_UNDF	0
+#define	N_ABS	02
+#define	N_TEXT	04
+#define	N_DATA	06
+#define	N_BSS	010
+#define	N_EXT	01
+#define N_FN	0x1f
+
+/*
+ * Header and section table of new format object file.
+ */
+struct outhead	outhead;
+struct outsect	outsect[S_MAX];
+
+char	*output_file;
+int	outputfile_created;
+long magic;
+
+int rom_in_data;
+
+char *program ;
+
+char flag ;
+
+/* Output file definitions and such */
+
+struct bhdr bh;
+
+#define ENTRY 0x02000
+#define TOT_HDRSIZE	(sizeof(struct bhdr))
+
+
+
+#define TEXTSG	0
+#define ROMSG	1
+#define DATASG	2
+#define BSSSG	3
+#define LSECT	BSSSG+1
+#define NSECT	LSECT+1
+
+int		output;
+
+int unresolved;
+long	textsize ; 
+long	datasize ;
+long	bsssize;
+
+main(argc, argv)
+	int	argc;
+	char	*argv[];
+{
+	register int		nsect;
+
+	program= argv[0] ;
+	if ( argc>1 && argv[1][0]=='-' ) {
+		flag=argv[1][1] ;
+		argc-- ; argv++ ;
+	}
+	switch (argc) {
+	case 3:	if ((output = creat(argv[2], 0644)) < 0 ||
+		    (close(output), output = open(argv[2],2)) < 0)
+			fatal("Can't write %s.\n", argv[2]);
+		output_file = argv[2];
+		outputfile_created = 1;
+		if (! rd_open(argv[1]))
+			fatal("Can't read %s.\n", argv[1]);
+		break;
+	default:fatal("Usage: %s <ACK object> <Sun object>.\n", argv[0]);
+	}
+	rd_ohead(&outhead);
+	if (BADMAGIC(outhead))
+		fatal("Not an ack object file.\n");
+	if (outhead.oh_flags & HF_LINK) {
+		unresolved++;
+		fprintf(stderr,"Warning: contains unresolved references.\n");
+	}
+	else if (outhead.oh_nrelo > 0)
+		fprintf(stderr, "Warning: relocation information present.\n");
+	if ( outhead.oh_nsect!=LSECT && outhead.oh_nsect!=NSECT )
+		fatal("Input file must have %d sections, not %ld\n",
+			NSECT,outhead.oh_nsect) ;
+	rd_sect(outsect, outhead.oh_nsect);
+	/* A few checks */
+	if ( outsect[BSSSG].os_flen != 0 )
+		fatal("bss space contains initialized data\n") ;
+	if ( !unresolved && outsect[BSSSG].os_base != outsect[DATASG].os_base+
+					outsect[DATASG].os_size )
+		fatal("bss segment must follow data segment\n") ;
+	if ( outsect[ROMSG].os_lign == 0x20000 ) {
+		/* 410/413 file with ROMSG in data space */
+		rom_in_data = 1;
+		magic= NMAGIC ;
+		textsize= outsect[TEXTSG].os_size ;
+		datasize= outsect[ROMSG].os_size + outsect[DATASG].os_size ;
+		if ( outsect[DATASG].os_base != outsect[ROMSG].os_base+
+						outsect[ROMSG].os_size )
+			fatal("data segment must follow rom\n") ;
+	} else
+	if ( outsect[DATASG].os_lign == 0x20000 ) {
+		/* 410/413 file with ROMSG in instruction space */
+		rom_in_data = 0;
+		magic= NMAGIC ;
+		textsize= outsect[TEXTSG].os_size + outsect[ROMSG].os_size ;
+		datasize= outsect[DATASG].os_size ;
+		if ( outsect[ROMSG].os_base != outsect[TEXTSG].os_base+
+						outsect[TEXTSG].os_size )
+			fatal("rom segment must follow text\n") ;
+	} else {
+		/* Plain 407 file */
+		rom_in_data = 0;
+		magic= OMAGIC ;
+		textsize= outsect[TEXTSG].os_size + outsect[ROMSG].os_size ;
+		datasize= outsect[DATASG].os_size ;
+		if (!unresolved) {
+			if (outsect[ROMSG].os_base != outsect[TEXTSG].os_base+
+						outsect[TEXTSG].os_size )
+				fatal("rom segment must follow text\n") ;
+			if ( outsect[DATASG].os_base != outsect[ROMSG].os_base+
+						outsect[ROMSG].os_size )
+				fatal("data segment must follow rom\n") ;
+		}
+	}
+	if (outsect[TEXTSG].os_base == TOT_HDRSIZE+ENTRY) {
+		if (magic != NMAGIC) {
+			fatal("illegal alignments.\n");
+		}
+		magic = ZMAGIC;
+		textsize = (textsize + TOT_HDRSIZE + (0x2000 - 1)) & ~(0x2000 - 1);
+		datasize = (datasize + (0x2000 - 1)) & ~(0x2000 - 1);
+	}
+	bsssize = outsect[BSSSG].os_size;
+	if ( outhead.oh_nsect==NSECT ) {
+		if ( outsect[LSECT].os_base != outsect[BSSSG].os_base+
+						outsect[BSSSG].os_size )
+			fatal("end segment must follow bss\n") ;
+		if ( outsect[LSECT].os_size != 0 )
+			fatal("end segment must be empty\n") ;
+	}
+
+	if (magic != OMAGIC && unresolved) {
+		fatal("unresolved references with wrong magic number\n");
+	}
+
+	if ((magic == ZMAGIC && outsect[TEXTSG].os_base != TOT_HDRSIZE+ENTRY) ||
+	    (magic != ZMAGIC && !unresolved && outsect[TEXTSG].os_base != ENTRY)) {
+		fatal("Illegal entry point.\n");
+	}
+
+	bh.magic = magic;
+	bh.machtype = MACH;
+	bh.tsize = textsize;
+	bh.bsize = bsssize;
+	bh.dsize = datasize;
+	bh.rtsize = 0;
+	bh.rdsize = 0;
+	if (magic == ZMAGIC) bh.entry = TOT_HDRSIZE+ENTRY;
+	else if (!unresolved)	bh.entry = ENTRY;
+	else bh.entry = 0;
+
+	/* Action at last */
+	lseek(output,(long) TOT_HDRSIZE,0);
+	emits(&outsect[TEXTSG]) ;
+	if (rom_in_data && magic == ZMAGIC) {
+		lseek(output,textsize,0);
+	}
+	emits(&outsect[ROMSG]) ;
+	if (!rom_in_data && magic == ZMAGIC) {
+		lseek(output,textsize,0);
+	}
+	emits(&outsect[DATASG]) ;
+	if (magic == ZMAGIC) {
+		lseek(output,textsize + datasize,0);
+	}
+	if (unresolved) emit_relo();
+	emit_symtab();
+	bh.ssize = outhead.oh_nname * sizeof(struct sym);
+	lseek(output,0L,0);
+	cvshort(&(bh.machtype));
+	cvshort(&(bh.magic));
+	cvlong(&(bh.tsize));
+	cvlong(&(bh.dsize));
+	cvlong(&(bh.bsize));
+	cvlong(&(bh.ssize));
+	cvlong(&(bh.entry));
+	cvlong(&(bh.rtsize));
+	cvlong(&(bh.rdsize));
+	writef(&bh, 1, (long) TOT_HDRSIZE);
+	if ( outputfile_created  && !unresolved ) chmod(argv[2],0755);
+	return 0;
+}
+
+writef(addr,sz,cnt)
+	char *addr;
+	long cnt;
+{
+	cnt *= sz;
+
+	while (cnt) {
+		int i = cnt >= 0x4000 ? 0x4000 : cnt;
+
+		cnt -= i;
+		if (write(output, addr, i) < i) {
+			fatal("write error\n");
+		}
+		addr += i;
+	}
+}
+
+/*
+ * Transfer the emitted byted from one file to another.
+ */
+emits(section) struct outsect *section ; {
+	char		*p;
+	char		*calloc();
+	long sz = section->os_flen;
+
+	rd_outsect(section - outsect);
+	while (sz) {
+		unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
+		if (!(p = calloc(i, 1))) {
+			fatal("No memory.\n");
+		}
+		rd_emit(p, i);
+		if (write(output, p, i) < i) {
+			fatal("write error.\n");
+		}
+		free(p);
+		sz -= i;
+	}
+
+	sz = section->os_size - section->os_flen;
+	while (sz) {
+		unsigned int i = (sz >= 0x4000 ? 0x4000 : sz);
+		if (!(p = calloc(i, 1))) {
+			fatal("No memory.\n");
+		}
+		if (write(output, p, i) < i) {
+			fatal("write error.\n");
+		}
+		free(p);
+		sz -= i;
+	}
+}
+
+struct outname *ACKnames;
+
+emit_relo()
+{
+	struct outrelo *ACKrelo;
+	struct machrelo *MACHtrelo,*MACHdrelo;
+	register struct outrelo *ap;
+	register struct machrelo *mtp, *mdp;
+	unsigned int cnt = outhead.oh_nrelo;
+
+	ACKrelo = (struct outrelo *) calloc(cnt, sizeof(struct outrelo));
+	MACHtrelo = (struct machrelo *) calloc(cnt, sizeof(struct machrelo));
+	MACHdrelo = (struct machrelo *) calloc(cnt, sizeof(struct machrelo));
+	ACKnames = (struct outname *) calloc(outhead.oh_nname, sizeof(struct outname));
+	if (!(ap = ACKrelo) || !(mtp = MACHtrelo) || !(mdp = MACHdrelo) ||
+	    !ACKnames) {
+		fatal("No memory.\n");
+	}
+	rd_relo(ACKrelo, cnt);
+	rd_name(ACKnames, outhead.oh_nname);
+	while (cnt-- != 0) {
+		register struct machrelo *mp;
+
+		if (ap->or_sect - S_MIN <= ROMSG) mp = mtp++;
+		else mp = mdp++;
+		setlength(mp->relodata,(ap->or_type&RELSZ) >> 1);
+		setpcrel(mp->relodata,(ap->or_type&RELPC != 0));
+		mp->address = ap->or_addr;
+		if (ap->or_sect == ROMSG+S_MIN) {
+			mp->address += outsect[TEXTSG].os_size;
+		}
+		if (ap->or_nami < outhead.oh_nname) {
+			if (ACKnames[ap->or_nami].on_type & S_EXT) {
+				setsymbolnum(mp->relodata, ap->or_nami);
+				setextern(mp->relodata,1);
+			}
+			else {
+				patch(ap, &ACKnames[ap->or_nami], mp);
+			}
+		}
+		else {
+			setsymbolnum(mp->relodata, N_ABS);
+		}
+		cvlong(&(mp->address));
+		cvlong(&(mp->relodata));
+		ap++;
+	}
+	bh.rtsize = (char *) mtp - (char *) MACHtrelo;
+	bh.rdsize = (char *) mdp - (char *) MACHdrelo;
+	writef(MACHtrelo, 1, bh.rtsize);
+	writef(MACHdrelo, 1, bh.rdsize);
+	free(ACKrelo);
+	free(MACHtrelo);
+	free(MACHdrelo);
+}
+
+long
+get(sz)
+{
+	char buf[10];
+	long l = 0;
+	register char *p = buf;
+
+	read(output,buf,sz);
+	while (sz--) {
+		l = (l << 8) | (*p++ & 0377);
+	}
+}
+
+put(l,sz)
+	long l;
+{
+	char buf[10];
+	register char *p;
+
+	*p++ = l >> 24;
+	*p++ = l >> 16;
+	*p++ = l >> 8;
+	*p++ = l;
+	p -= sz;
+	if (write(output, p, sz) < sz) {
+		fatal("write error.\n");
+	}
+}
+
+patch(ap, an, mp)
+	register struct outrelo *ap;
+	register struct outname *an;
+	register struct machrelo *mp;
+{
+	int whichsect = (an->on_type & S_TYP) - S_MIN;
+	long correction = 0;
+	long where = TOT_HDRSIZE+ap->or_addr;
+	long X;
+	long here;
+	int sz;
+
+	if (!(an->on_type & S_SCT)) {
+		fprintf(stderr,"funny on_type %x\n", an->on_type);
+	}
+	switch(whichsect) {
+	case TEXTSG:
+		setsymbolnum(mp->relodata,N_TEXT);
+		return;
+	case DATASG:
+		correction = outsect[ROMSG].os_size + outsect[TEXTSG].os_size;
+		setsymbolnum(mp->relodata,N_DATA);
+		break;
+	case ROMSG:
+		correction += outsect[TEXTSG].os_size;
+		setsymbolnum(mp->relodata,N_TEXT);
+		break;
+	default:
+		assert(0);
+	}
+
+	switch(ap->or_sect - S_MIN) {
+	case DATASG:
+		where += outsect[ROMSG].os_size;
+	case ROMSG:
+		where += outsect[TEXTSG].os_size;
+	case TEXTSG:
+		break;
+	default:
+		assert(0);
+	}
+	here = lseek(output, 0L, 1);
+	lseek(output, where, 0);
+	sz = ap->or_type & RELSZ;
+	X = get(sz) + correction;
+	lseek(output, where, 0);
+	put(X,sz);
+	lseek(output, here, 0);
+}
+
+cvlong(l)
+	long *l;
+{
+	long x = *l;
+	char *p = (char *) l;
+
+	*p++ = x >> 24;
+	*p++ = x >> 16;
+	*p++ = x >> 8;
+	*p = x;
+}
+
+cvshort(s)
+	short *s;
+{
+	short x = *s;
+	char *p = (char *) s;
+
+	*p++ = x >> 8;
+	*p = x;
+}
+
+emit_symtab()
+{
+	register unsigned short i = outhead.oh_nname;
+	register struct outname *A;
+	struct sym *MACHnames;
+	register struct sym *M;
+	extern char *malloc(), *calloc();
+	char *chars;
+	long offX = OFF_CHAR(outhead) - 4;
+
+	if (!(A = ACKnames)) {
+	    	if (!(A = (struct outname *)
+			calloc(i, sizeof(struct outname)))) {
+			fatal("No memory.\n");
+		}
+		rd_name(A, outhead.oh_nname);
+	}
+	if (!(M = (struct sym *) calloc(i, sizeof(struct sym)))) {
+		fatal("No memory.\n");
+	}
+	MACHnames = M;
+	ACKnames = A;
+	for (; i; i--, A++, M++) {
+		M->value = A->on_valu;
+		switch(A->on_type & S_TYP) {
+			case S_UND:
+				M->type = N_UNDF;
+				break;
+			case S_ABS:
+				M->type = N_ABS;
+				break;
+			case S_MIN + TEXTSG:
+				if (! A->on_type & S_COM) {
+					M->value += outsect[TEXTSG].os_base;
+				}
+				M->type = N_TEXT; 
+				break;
+			case S_MIN + ROMSG:
+				M->type = (rom_in_data ? N_DATA : N_TEXT);
+				if (! A->on_type & S_COM) {
+					M->value += outsect[ROMSG].os_base;
+				}
+				break;
+			case S_MIN + DATASG:
+				M->type = N_DATA;
+				if (! A->on_type & S_COM) {
+					M->value += outsect[DATASG].os_base;
+				}
+				break;
+			case S_MIN + BSSSG:
+				M->type = N_BSS;
+				if (! A->on_type & S_COM) {
+					M->value += outsect[BSSSG].os_base;
+				}
+				break;
+			case S_MIN + LSECT:
+				M->type = N_BSS;
+				if (! A->on_type & S_COM) {
+					M->value += outsect[LSECT].os_base;
+				}
+				break;
+			default:
+				fprintf(stderr,"warning: unknown s_type: %d\n",
+					A->on_type & S_TYP);
+		}
+		if (A->on_type & S_EXT) M->type |= N_EXT;
+		if (M->name = A->on_foff) {
+			M->name -= offX;
+		}
+		cvlong(&(M->name));
+		cvlong(&(M->value));
+	}
+	writef(MACHnames, sizeof(struct sym), (long) outhead.oh_nname);
+	free(MACHnames);
+	free(ACKnames);
+	if ((unsigned) outhead.oh_nchar != outhead.oh_nchar ||
+	    !( chars = malloc((unsigned) outhead.oh_nchar))) {
+		fatal("No memory\n.");
+	}
+	put(outhead.oh_nchar+4,4);
+	rd_string(chars,outhead.oh_nchar);
+	writef(chars, 1, outhead.oh_nchar);
+	free(chars);
+}
+
+/* VARARGS1 */
+fatal(s, a1, a2)
+	char	*s;
+{
+	fprintf(stderr,"%s: ",program) ;
+	fprintf(stderr, s, a1, a2);
+	if (outputfile_created)
+		unlink(output_file);
+	exit(-1);
+}
+
+rd_fatal() { fatal("read error.\n"); }

+ 159 - 0
mach/sun3/libsys/LIST

@@ -0,0 +1,159 @@
+libmon_s.a
+accept.s
+access.s
+acct.s
+adjtime.s
+alarm.c
+async_dem.s
+bind.s
+cerror.s
+chdir.s
+chmod.s
+chown.s
+chroot.s
+cleanup.c
+close.s
+connect.s
+creat.s
+dup.s
+dup2.s
+execl.c
+execle.c
+execv.c
+execve.s
+exit.c
+exportfs.s
+fchmod.s
+fchown.s
+fcntl.s
+flock.s
+fork.s
+fstat.s
+fstatfs.s
+fsync.s
+ftime.c
+ftruncate.s
+getdirent.s
+getdomnam.s
+getdopt.s
+getdtabsz.s
+getfh.s
+getgid.s
+getgroups.s
+gethostid.s
+gethostnam.s
+getitimer.s
+getpagesiz.s
+getpeernam.s
+getpgrp.s
+getpid.s
+getprio.s
+getrlimit.s
+getrusage.s
+getsocknam.s
+getsockopt.s
+gettimday.s
+getuid.s
+ioctl.s
+kill.s
+killpg.s
+link.s
+listen.s
+lseek.s
+lstat.s
+madvise.s
+mincore.s
+mkdir.s
+mknod.s
+mmap.s
+mount.s
+mprotect.s
+mremap.s
+msgsys.s
+munmap.s
+nfssvc.s
+nice.c
+open.s
+pause.c
+pipe.s
+profil.s
+ptrace.s
+quotactl.s
+read.s
+readlink.s
+readv.s
+reboot.s
+recv.s
+recvfrom.s
+recvmsg.s
+rename.s
+rmdir.s
+sbrk.s
+select.s
+semsys.s
+send.s
+sendmsg.s
+sendto.s
+setdomnam.s
+setdopt.s
+setgroups.s
+sethostnam.s
+setitimer.s
+setpgrp.s
+setprio.s
+setregid.s
+setreuid.s
+setrlimit.s
+setsockopt.s
+settimday.s
+shmsys.s
+shutdown.s
+sigblock.s
+signal.c
+sigpause.s
+sigsetmask.s
+sigstack.s
+sigtramp.s
+sigvec.c
+socket.s
+socketpair.s
+sstk.s
+stat.s
+statfs.s
+swapon.s
+symlink.s
+sync.s
+syscall.s
+time.c
+times.c
+truncate.s
+umask.s
+unlink.s
+unmount.s
+ustat.s
+utime.c
+utimes.s
+vhangup.s
+wait.s
+write.s
+writev.s
+_exit.s
+stty.c
+gtty.c
+getegid.s
+geteuid.s
+getppid.s
+lockf.c
+msg.s
+plock.c
+sem.s
+setgid.c
+setuid.c
+shm.s
+stime.c
+tell.c
+ulimit.c
+uname.c
+vadvise.s
+vfork.s
+wait3.s

+ 29 - 0
mach/sun3/libsys/Makefile

@@ -0,0 +1,29 @@
+# $Header$
+MACH=m68020
+all:		libmon_o.a head_em.o
+
+install: 	all
+		../../install head_em.o head_em
+		../../install libmon_o.a tail_mon
+
+
+cmp:		all
+		-../../compare head_em.o head_em
+		-../../compare libmon_o.a tail_mon
+
+libmon_o.a:	libmon_s.a
+		ASAR=aal ; export ASAR ;\
+		march . libmon_o.a
+
+head_em.o:	head_em.s
+		$(MACH) -I../../../h -c head_em.s
+
+clean:
+		rm -f *.o libmon_o.a
+
+opr :
+		make pr | opr
+
+pr:
+		@pr `pwd`/head_em.s
+		@arch pv libmon_s.a | pr -h `pwd`/libmon_s.a

+ 7 - 0
mach/sun3/libsys/_exit.s

@@ -0,0 +1,7 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define __exit
+__exit:
+	pea	(SYS_exit)
+	trap	#0
+	jmp	(cerror)

+ 4 - 0
mach/sun3/libsys/accept.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _accept
+_accept: SYSTEM(SYS_accept)

+ 4 - 0
mach/sun3/libsys/access.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _access
+_access: SYSTEM(SYS_access)

+ 4 - 0
mach/sun3/libsys/acct.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _acct
+_acct: SYSTEM(SYS_acct)

+ 4 - 0
mach/sun3/libsys/adjtime.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _adjtime
+_adjtime: SYSTEM(SYS_adjtime)

+ 13 - 0
mach/sun3/libsys/alarm.c

@@ -0,0 +1,13 @@
+unsigned
+alarm(n)
+	unsigned n;
+{
+	struct { long l1,l2,l3,l4; } t1,t2;
+	t1.l1 = 0;
+	t1.l2 = 0;
+	t1.l4 = 0;
+	t1.l3 = n;
+	if (setitimer(0,&t1,&t2) < 0) return -1;
+	if (t2.l4) t2.l3++;
+	return t2.l3;
+}

+ 4 - 0
mach/sun3/libsys/async_dem.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _async_daemon
+_async_daemon: SYSTEM(SYS_async_daemon)

+ 4 - 0
mach/sun3/libsys/bind.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _bind
+_bind: SYSTEM(SYS_bind)

+ 9 - 0
mach/sun3/libsys/cerror.s

@@ -0,0 +1,9 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define cerror,_errno
+cerror:
+	move.l	d0,(_errno)
+	move.l	#-1,d0
+	rts
+
+.sect .bss
+_errno:	.space 4

+ 4 - 0
mach/sun3/libsys/chdir.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _chdir
+_chdir: SYSTEM(SYS_chdir)

+ 4 - 0
mach/sun3/libsys/chmod.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _chmod
+_chmod: SYSTEM(SYS_chmod)

+ 4 - 0
mach/sun3/libsys/chown.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _chown
+_chown: SYSTEM(SYS_chown)

+ 4 - 0
mach/sun3/libsys/chroot.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _chroot
+_chroot: SYSTEM(SYS_chroot)

+ 1 - 0
mach/sun3/libsys/cleanup.c

@@ -0,0 +1 @@
+_cleanup() { }

+ 4 - 0
mach/sun3/libsys/close.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _close
+_close: SYSTEM(SYS_close)

+ 4 - 0
mach/sun3/libsys/compmodule

@@ -0,0 +1,4 @@
+if m68020 -c -L $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi

+ 4 - 0
mach/sun3/libsys/connect.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _connect
+_connect: SYSTEM(SYS_connect)

+ 4 - 0
mach/sun3/libsys/creat.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _creat
+_creat: SYSTEM(SYS_creat)

+ 4 - 0
mach/sun3/libsys/dup.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _dup
+_dup: SYSTEM(SYS_dup)

+ 4 - 0
mach/sun3/libsys/dup2.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _dup2
+_dup2: SYSTEM(SYS_dup2)

+ 8 - 0
mach/sun3/libsys/execl.c

@@ -0,0 +1,8 @@
+execl(name,args)
+	char *name;
+	int args;
+{
+	extern char **environ;
+
+	execve(name,&args,environ);
+}

+ 9 - 0
mach/sun3/libsys/execle.c

@@ -0,0 +1,9 @@
+execle(name,args)
+	char *name;
+	char *args;
+{
+	char **p = &args;
+	while (*p++) ;
+
+	execve(name,&args,*p);
+}

+ 7 - 0
mach/sun3/libsys/execv.c

@@ -0,0 +1,7 @@
+execv(name,args)
+	char *name;
+	char **args;
+{
+	extern char **environ;
+	execve(name,args,environ);
+}

+ 4 - 0
mach/sun3/libsys/execve.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _execve
+_execve: SYSTEM(SYS_execve)

+ 5 - 0
mach/sun3/libsys/exit.c

@@ -0,0 +1,5 @@
+exit(n)
+{
+	_cleanup();
+	_exit(n);
+}

+ 4 - 0
mach/sun3/libsys/exportfs.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _exportfs
+_exportfs: SYSTEM(SYS_exportfs)

+ 4 - 0
mach/sun3/libsys/fchmod.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fchmod
+_fchmod: SYSTEM(SYS_fchmod)

+ 4 - 0
mach/sun3/libsys/fchown.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fchown
+_fchown: SYSTEM(SYS_fchown)

+ 4 - 0
mach/sun3/libsys/fcntl.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fcntl
+_fcntl: SYSTEM(SYS_fcntl)

+ 4 - 0
mach/sun3/libsys/flock.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _flock
+_flock: SYSTEM(SYS_flock)

+ 14 - 0
mach/sun3/libsys/fork.s

@@ -0,0 +1,14 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fork
+_fork:
+	pea	(SYS_fork)
+	trap	#0
+	bcs	1f
+	tst.l	d1
+	beq	2f
+	clr.l	d0
+2:
+	rts
+1:
+	jmp	(cerror)

+ 4 - 0
mach/sun3/libsys/fstat.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fstat
+_fstat: SYSTEM(SYS_fstat)

+ 4 - 0
mach/sun3/libsys/fstatfs.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fstatfs
+_fstatfs: SYSTEM(SYS_fstatfs)

+ 4 - 0
mach/sun3/libsys/fsync.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _fsync
+_fsync: SYSTEM(SYS_fsync)

+ 15 - 0
mach/sun3/libsys/ftime.c

@@ -0,0 +1,15 @@
+#include <sys/types.h>
+
+ftime(p)
+	struct { time_t time; unsigned short millitm;
+		 short timezone; short dstflag; } *p;
+{
+	struct { long l1,l2; } t1,t2;
+
+	if (gettimeofday(&t1,&t2) < 0) return -1;
+	p->time = t1.l1;
+	p->millitm = t1.l2/1000;
+	p->dstflag = t2.l2;
+	p->timezone = t2.l1;
+	return 0;
+}

+ 4 - 0
mach/sun3/libsys/ftruncate.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _ftruncate
+_ftruncate: SYSTEM(SYS_ftruncate)

+ 4 - 0
mach/sun3/libsys/getdirent.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getdirentries
+_getdirentries: SYSTEM(SYS_getdirentries)

+ 4 - 0
mach/sun3/libsys/getdomnam.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getdomainname
+_getdomainname: SYSTEM(SYS_getdomainname)

+ 4 - 0
mach/sun3/libsys/getdopt.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getdopt
+_getdopt: SYSTEM(SYS_getdopt)

+ 4 - 0
mach/sun3/libsys/getdtabsz.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getdtablesize
+_getdtablesize: SYSTEM(SYS_getdtablesize)

+ 8 - 0
mach/sun3/libsys/getegid.s

@@ -0,0 +1,8 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getegid
+_getegid:
+	pea	(SYS_getgid)
+	trap	#0
+	move.l	d1,d0
+	rts

+ 8 - 0
mach/sun3/libsys/geteuid.s

@@ -0,0 +1,8 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _geteuid
+_geteuid:
+	pea	(SYS_getuid)
+	trap	#0
+	move.l	d1,d0
+	rts

+ 4 - 0
mach/sun3/libsys/getfh.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getfh
+_getfh: SYSTEM(SYS_getfh)

+ 4 - 0
mach/sun3/libsys/getgid.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getgid
+_getgid: SYSTEM(SYS_getgid)

+ 4 - 0
mach/sun3/libsys/getgroups.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getgroups
+_getgroups: SYSTEM(SYS_getgroups)

+ 4 - 0
mach/sun3/libsys/gethostid.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _gethostid
+_gethostid: SYSTEM(SYS_gethostid)

+ 4 - 0
mach/sun3/libsys/gethostnam.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _gethostname
+_gethostname: SYSTEM(SYS_gethostname)

+ 4 - 0
mach/sun3/libsys/getitimer.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getitimer
+_getitimer: SYSTEM(SYS_getitimer)

+ 4 - 0
mach/sun3/libsys/getpagesiz.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpagesize
+_getpagesize: SYSTEM(SYS_getpagesize)

+ 4 - 0
mach/sun3/libsys/getpeernam.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpeername
+_getpeername: SYSTEM(SYS_getpeername)

+ 4 - 0
mach/sun3/libsys/getpgrp.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpgrp
+_getpgrp: SYSTEM(SYS_getpgrp)

+ 4 - 0
mach/sun3/libsys/getpid.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpid
+_getpid: SYSTEM(SYS_getpid)

+ 8 - 0
mach/sun3/libsys/getppid.s

@@ -0,0 +1,8 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getppid
+_getppid:
+	pea	(SYS_getpid)
+	trap	#0
+	move.l	d1,d0
+	rts

+ 4 - 0
mach/sun3/libsys/getprio.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getpriority
+_getpriority: SYSTEM(SYS_getpriority)

+ 4 - 0
mach/sun3/libsys/getrlimit.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getrlimit
+_getrlimit: SYSTEM(SYS_getrlimit)

+ 4 - 0
mach/sun3/libsys/getrusage.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getrusage
+_getrusage: SYSTEM(SYS_getrusage)

+ 4 - 0
mach/sun3/libsys/getsocknam.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getsockname
+_getsockname: SYSTEM(SYS_getsockname)

+ 4 - 0
mach/sun3/libsys/getsockopt.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getsockopt
+_getsockopt: SYSTEM(SYS_getsockopt)

+ 4 - 0
mach/sun3/libsys/gettimday.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _gettimeofday
+_gettimeofday: SYSTEM(SYS_gettimeofday)

+ 4 - 0
mach/sun3/libsys/getuid.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _getuid
+_getuid: SYSTEM(SYS_getuid)

+ 7 - 0
mach/sun3/libsys/gtty.c

@@ -0,0 +1,7 @@
+#include <sgtty.h>
+int gtty(fildes,argp)
+	int fildes ;
+	struct sgttyb *argp ;
+{
+	return ioctl(fildes,TIOCGETP,argp) ;
+}

+ 65 - 0
mach/sun3/libsys/head_em.s

@@ -0,0 +1,65 @@
+.define .lino,.filn
+.define EXIT
+.define	begtext,begdata,begbss
+.define	EARRAY,ERANGE,ESET,EIDIVZ,EHEAP,EILLINS,ECASE,EBADGTO
+.define	hol0,.reghp,.limhp,.trpim,.trppc
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+
+
+
+! runtime startof for 68020 machine
+
+
+LINO_AD	= 0
+FILN_AD	= 4
+
+EARRAY	= 0
+ERANGE	= 1
+ESET	= 2
+EIDIVZ	= 6
+EHEAP	= 17
+EILLINS	= 18
+ECASE	= 20
+EBADGTO = 27
+
+	.sect .text
+begtext:
+	move.l	(sp),d2
+	lea	(4,sp),a0
+	move.l	d2,d1
+	add.l	#1,d1
+	asl.l	#2,d1
+	move.l	a0,a1
+	add.l	d1,a1
+	pea	(a1)
+	pea	(a0)
+	move.l	d2,-(sp)
+	move.l	#0,a6
+	jsr	(_m_a_i_n)
+	move.l	d0,(sp)		! no stack cleanup needed
+EXIT:
+	jsr	(_exit)
+
+	.sect .data
+begdata:
+	.data4 0		! may be at virtual address 0 with no problem
+hol0:
+.lino:
+	.data4	0	! lino
+.filn:
+	.data4	0	! filn
+.reghp:
+	.data4	endbss
+.limhp:
+	.data4	endbss
+.trppc:
+	.data4	0
+.trpim:
+	.data4	0	! USED TO BE 2 BYTES; IS THIS RIGHT?
+
+
+	.sect .bss
+begbss: !initialization is not needed because ALL entries are in zero space!

+ 4 - 0
mach/sun3/libsys/ioctl.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _ioctl
+_ioctl: SYSTEM(SYS_ioctl)

+ 4 - 0
mach/sun3/libsys/kill.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _kill
+_kill: SYSTEM(SYS_kill)

+ 4 - 0
mach/sun3/libsys/killpg.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _killpg
+_killpg: SYSTEM(SYS_killpg)

+ 4 - 0
mach/sun3/libsys/link.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _link
+_link: SYSTEM(SYS_link)

+ 4 - 0
mach/sun3/libsys/listen.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _listen
+_listen: SYSTEM(SYS_listen)

+ 43 - 0
mach/sun3/libsys/lockf.c

@@ -0,0 +1,43 @@
+#include <errno.h>
+lockf(fildes, mode, size)
+	long size;
+{
+	struct {
+		short type, whence; long start, end; short pid;
+	} x;
+	int i = 8;
+	extern int errno;
+
+	x.type = 2;
+	x.whence = 1;
+	x.start = 0;
+	x.end = size;
+	switch(mode) {
+	case 0:
+		x.type = 3;
+		break;
+	case 1:
+		i = 9;
+		break;
+	case 2:
+		break;
+	case 3:
+		if (fcntl(fildes,7,&x) == -1) {
+			return -1;
+		}
+		if (x.type == 3) {
+			return 0;
+		}
+		errno = EACCES;
+		return -1;
+	default:
+		errno = EINVAL;
+		return -1;
+	}
+	if (fcntl(fildes,i,&x) == -1) {
+		if (errno = 79) {
+			errno = 78;
+		}
+		return -1;
+	}
+}

+ 4 - 0
mach/sun3/libsys/lseek.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _lseek
+_lseek: SYSTEM(SYS_lseek)

+ 4 - 0
mach/sun3/libsys/lstat.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _lstat
+_lstat: SYSTEM(SYS_lstat)

+ 4 - 0
mach/sun3/libsys/madvise.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _madvise
+_madvise: SYSTEM(SYS_madvise)

+ 4 - 0
mach/sun3/libsys/mincore.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mincore
+_mincore: SYSTEM(SYS_mincore)

+ 4 - 0
mach/sun3/libsys/mkdir.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mkdir
+_mkdir: SYSTEM(SYS_mkdir)

+ 4 - 0
mach/sun3/libsys/mknod.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mknod
+_mknod: SYSTEM(SYS_mknod)

+ 4 - 0
mach/sun3/libsys/mmap.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mmap
+_mmap: SYSTEM(SYS_mmap)

+ 4 - 0
mach/sun3/libsys/mount.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mount
+_mount: SYSTEM(SYS_mount)

+ 4 - 0
mach/sun3/libsys/mprotect.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mprotect
+_mprotect: SYSTEM(SYS_mprotect)

+ 4 - 0
mach/sun3/libsys/mremap.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _mremap
+_mremap: SYSTEM(SYS_mremap)

+ 18 - 0
mach/sun3/libsys/msg.s

@@ -0,0 +1,18 @@
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _msgget,_msgctl,_msgrcv,_msgsnd
+_msgget:
+	pea	(0)
+	bra	1f
+_msgctl:
+	pea	(1)
+	bra	1f
+_msgrcv:
+	pea	(2)
+	bra	1f
+_msgsnd:
+	pea	(3)
+1:
+	move.l	(4,sp),d0
+	move.l	(sp),(4,sp)
+	move.l	d0,(sp)
+	jmp	(_msgsys)

+ 4 - 0
mach/sun3/libsys/msgsys.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _msgsys
+_msgsys: SYSTEM(SYS_msgsys)

+ 4 - 0
mach/sun3/libsys/munmap.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _munmap
+_munmap: SYSTEM(SYS_munmap)

+ 4 - 0
mach/sun3/libsys/nfssvc.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _nfssvc
+_nfssvc: SYSTEM(SYS_nfssvc)

+ 13 - 0
mach/sun3/libsys/nice.c

@@ -0,0 +1,13 @@
+nice(incr)
+{
+	extern int errno;
+	int sav = errno;
+	int prio;
+
+	errno = 0;
+	prio = getpriority(0,0);
+	if (prio == -1 && errno) return -1;
+	if (setpriority(0,0,prio+incr) < 0) return -1;
+	errno = sav;
+	return 0;
+}

+ 4 - 0
mach/sun3/libsys/open.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _open
+_open: SYSTEM(SYS_open)

+ 3 - 0
mach/sun3/libsys/pause.c

@@ -0,0 +1,3 @@
+pause() {
+	sigpause(sigblock());
+}

+ 14 - 0
mach/sun3/libsys/pipe.s

@@ -0,0 +1,14 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _pipe
+_pipe:
+	pea	(SYS_pipe)
+	trap	#0
+	bcs	1f
+	move.l	(4,sp),a0
+	move.l	d0,(a0)+
+	move.l	d1,(a0)
+	clr.l	d0
+	rts
+1:
+	jmp	(cerror)

+ 8 - 0
mach/sun3/libsys/plock.c

@@ -0,0 +1,8 @@
+#include <errno.h>
+plock(op)
+{
+	extern int errno;
+
+	errno = EPERM;
+	return -1;
+}

+ 4 - 0
mach/sun3/libsys/profil.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _profil
+_profil: SYSTEM(SYS_profil)

+ 7 - 0
mach/sun3/libsys/ptrace.s

@@ -0,0 +1,7 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _ptrace
+.extern _errno
+_ptrace:
+	clr.l	(_errno)
+	SYSTEM(SYS_ptrace)

+ 4 - 0
mach/sun3/libsys/quotactl.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _quotactl
+_quotactl: SYSTEM(SYS_quotactl)

+ 4 - 0
mach/sun3/libsys/read.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _read
+_read: SYSTEM(SYS_read)

+ 4 - 0
mach/sun3/libsys/readlink.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _readlink
+_readlink: SYSTEM(SYS_readlink)

+ 4 - 0
mach/sun3/libsys/readv.s

@@ -0,0 +1,4 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _readv
+_readv: SYSTEM(SYS_readv)

+ 10 - 0
mach/sun3/libsys/reboot.s

@@ -0,0 +1,10 @@
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define _reboot
+_reboot:
+	pea	(SYS_reboot)
+	trap	#0
+	bcs	1f
+	stop	#0
+1:
+	jmp	(cerror)

Някои файлове не бяха показани, защото твърде много файлове са промени