*BSD News Article 21695


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!dog.ee.lbl.gov!horse.ee.lbl.gov!torek
From: torek@horse.ee.lbl.gov (Chris Torek)
Newsgroups: comp.unix.bsd
Subject: Fixes for 4.4BSD SPARC kernels (was 4.4BSD on SPARCstation IPC)
Date: 30 Sep 1993 23:13:42 GMT
Organization: Lawrence Berkeley Laboratory, Berkeley CA
Lines: 961
Message-ID: <34305@dog.ee.lbl.gov>
References: <ma5la6INNfdn@news.bbn.com> <34206@dog.ee.lbl.gov>
NNTP-Posting-Host: 128.3.112.15

In article <34206@dog.ee.lbl.gov> I wrote:
>The problem with 4.4BSD on machines with other than 16 MB has now been
>found (now that we have a 32 MB machine at LBL).  Several other less-
>important (but still significant) bugs have also been fixed.  I plan to
>post patches as soon as I can re-integrate the changes with the
>official 4.4BSD sources.

Here are the various changes.  WARNING: these have *not* been tested
in an official 4.4BSD kernel.  Indeed, some of them have been tested
at best quite lightly, but I felt they were important enough to post
anyway.

The patch to pmap.c fixes the `> 16 MB' problem, and is by far the
most important of these.  (If you read the comments attached to the
patch, you should be able to figure out what was going wrong. :-) )

In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 510 486 5427)
Berkeley, CA		Domain:	torek@ee.lbl.gov

diff -r -c2 /nbsd/sys/sparc/include/autoconf.h ./include/autoconf.h
*** /nbsd/sys/sparc/include/autoconf.h	Fri Jun 11 15:11:37 1993
--- ./include/autoconf.h	Thu Sep 30 15:43:56 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)autoconf.h	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: autoconf.h,v 1.10 92/11/26 02:04:32 torek Exp $ (LBL)
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)autoconf.h	8.2 (Berkeley) 9/30/93
   *
!  * from: $Header: autoconf.h,v 1.11 93/09/28 05:26:41 leres Exp $ (LBL)
   */
  
***************
*** 138,139 ****
--- 138,142 ----
  
  struct device *bootdv;			/* found during autoconfiguration */
+ 
+ /* Parse a disk string into a dev_t, return device struct pointer */
+ struct	device *parsedisk __P((char *, int, int, dev_t *));

diff -r -c2 /nbsd/sys/sparc/include/psl.h ./include/psl.h
*** /nbsd/sys/sparc/include/psl.h	Fri Jun 11 15:12:29 1993
--- ./include/psl.h	Mon Sep 27 14:08:28 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)psl.h	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: psl.h,v 1.12 92/11/26 02:04:42 torek Exp $
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)psl.h	8.2 (Berkeley) 9/27/93
   *
!  * from: $Header: psl.h,v 1.13 93/09/27 01:37:25 torek Exp $
   */
  
***************
*** 78,82 ****
  #define	PIL_CLOCK	10
  
! #ifndef LOCORE
  /*
   * GCC pseudo-functions for manipulating PSR (primarily PIL field).
--- 78,82 ----
  #define	PIL_CLOCK	10
  
! #if defined(KERNEL) && !defined(LOCORE)
  /*
   * GCC pseudo-functions for manipulating PSR (primarily PIL field).
***************
*** 180,184 ****
  	__asm __volatile("nop; nop; nop");
  }
! #endif /* LOCORE */
  
  #endif /* PSR_IMPL */
--- 180,184 ----
  	__asm __volatile("nop; nop; nop");
  }
! #endif /* KERNEL && !LOCORE */
  
  #endif /* PSR_IMPL */

diff -r -c2 /nbsd/sys/sparc/include/stdarg.h ./include/stdarg.h
*** /nbsd/sys/sparc/include/stdarg.h	Fri Jun 11 15:12:48 1993
--- ./include/stdarg.h	Mon Sep 27 14:13:28 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)stdarg.h	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: stdarg.h,v 1.8 93/05/07 18:10:14 torek Exp $
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)stdarg.h	8.2 (Berkeley) 9/27/93
   *
!  * from: $Header: stdarg.h,v 1.9 93/09/27 21:12:38 torek Exp $
   */
  
***************
*** 61,66 ****
   * va_end cleans up after va_start.  There is nothing to do there.
   */
  #define va_start(ap, l)	(__builtin_saveregs(), \
! 			 ap = (char *)__builtin_next_arg())
  #define va_end(ap)	/* empty */
  
--- 61,70 ----
   * va_end cleans up after va_start.  There is nothing to do there.
   */
+ #ifdef __GCC_NEW_VARARGS__	/* gcc 2.4.5 */
+ #define va_start(ap, l)	((ap) = (char *)__builtin_saveregs())
+ #else				/* gcc 2.3.3 */
  #define va_start(ap, l)	(__builtin_saveregs(), \
! 			 (ap) = (char *)__builtin_next_arg())
! #endif
  #define va_end(ap)	/* empty */
  
diff -r -c2 /nbsd/sys/sparc/include/varargs.h ./include/varargs.h
*** /nbsd/sys/sparc/include/varargs.h	Fri Jun 11 15:12:58 1993
--- ./include/varargs.h	Mon Sep 27 14:13:28 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)varargs.h	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: varargs.h,v 1.7 93/05/07 18:10:36 torek Exp $
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)varargs.h	8.2 (Berkeley) 9/27/93
   *
!  * from: $Header: varargs.h,v 1.8 93/09/27 00:53:20 torek Exp $
   */
  
***************
*** 54,62 ****
  #define __extension__
  #define	va_dcl	int va_alist;
! #else /* gcc2 wants to see the '...' token */
  #define	va_dcl	int va_alist; ...
  #endif
  
  #define	va_start(ap)	(__builtin_saveregs(), (ap) = (char *)&va_alist)
  #define va_end(ap)	/* empty */
  
--- 54,71 ----
  #define __extension__
  #define	va_dcl	int va_alist;
! #else /* gcc2 */
! #ifdef __GCC_NEW_VARARGS__	/* gcc 2.4.5 */
! #define va_alist __builtin_va_alist
! #define	va_dcl	int __builtin_va_alist;
! #else				/* gcc 2.3.3 */
  #define	va_dcl	int va_alist; ...
  #endif
+ #endif
  
+ #ifdef __GCC_NEW_VARARGS__
+ #define	va_start(ap)	((ap) = (char *)__builtin_saveregs())
+ #else
  #define	va_start(ap)	(__builtin_saveregs(), (ap) = (char *)&va_alist)
+ #endif
  #define va_end(ap)	/* empty */
  
diff -r -c2 /nbsd/sys/sparc/rcons/rcons_kern.c ./rcons/rcons_kern.c
*** /nbsd/sys/sparc/rcons/rcons_kern.c	Fri Jun 11 15:14:02 1993
--- ./rcons/rcons_kern.c	Mon Sep 27 14:16:15 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)rcons_kern.c	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: rcons_kern.c,v 1.28 93/04/20 11:15:38 torek Exp $
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)rcons_kern.c	8.2 (Berkeley) 9/27/93
   *
!  * from: $Header: rcons_kern.c,v 1.29 93/09/27 00:52:02 torek Exp $
   */
  
***************
*** 200,204 ****
  	register int i;
  	static int row, col;
- 	char buf[100];
  
  	myfbdevicep = fb;
--- 200,203 ----
***************
*** 259,268 ****
  
  	/* Determine addresses of prom emulator row and column */
! 	fb->fb_row = fb->fb_col = NULL;
! 	sprintf(buf, "' line# >body >user %x !", &fb->fb_row);
! 	rominterpret(buf);
! 	sprintf(buf, "' column# >body >user %x !", &fb->fb_col);
! 	rominterpret(buf);
! 	if (fb->fb_row == NULL || fb->fb_col == NULL) {
  		/* Can't find addresses; use private copies */
  		fb->fb_row = &row;
--- 258,262 ----
  
  	/* Determine addresses of prom emulator row and column */
! 	if (romgetcursoraddr(&fb->fb_row, &fb->fb_col)) {
  		/* Can't find addresses; use private copies */
  		fb->fb_row = &row;

diff -r -c2 /nbsd/sys/sparc/sparc/autoconf.c ./sparc/autoconf.c
*** /nbsd/sys/sparc/sparc/autoconf.c	Fri Jun 11 15:15:55 1993
--- ./sparc/autoconf.c	Thu Sep 30 15:37:47 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)autoconf.c	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: autoconf.c,v 1.32 93/05/28 03:55:59 torek Exp $ (LBL)
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)autoconf.c	8.3 (Berkeley) 9/30/93
   *
!  * from: $Header: autoconf.c,v 1.37 93/09/28 07:19:48 leres Exp $ (LBL)
   */
  
***************
*** 82,86 ****
  static	int findblkmajor __P((struct dkdevice *));
  static	struct device *getdisk __P((char *, int, int, dev_t *));
- static	struct device *parsedisk __P((char *, int, int, dev_t *));
  
  struct	bootpath bootpath[8];
--- 82,85 ----
***************
*** 439,447 ****
  	static const char *const special[] = {
  		/* find these first (end with empty string) */
! 		"memory-error", "eeprom", "counter-timer", "",
  
  		/* ignore these (end with NULL) */
! 		"options", "packages", "openprom", "memory", "virtual-memory",
! 		"interrupt-enable", NULL
  	};
  
--- 438,455 ----
  	static const char *const special[] = {
  		/* find these first (end with empty string) */
! 		"eeprom",
! 		"counter-timer",
! 		"memory-error",
! 		"",
  
  		/* ignore these (end with NULL) */
! 		"aliases",
! 		"interrupt-enable",
! 		"memory",
! 		"openprom",
! 		"options",
! 		"packages",
! 		"virtual-memory",
! 		NULL
  	};
  
***************
*** 722,725 ****
--- 730,734 ----
  }
  
+ #ifdef RCONSOLE
  /* Pass a string to the FORTH PROM to be interpreted */
  void
***************
*** 734,737 ****
--- 743,775 ----
  }
  
+ /*
+  * Try to figure out where the PROM stores the cursor row & column
+  * variables.  Returns nonzero on error.
+  */
+ int
+ romgetcursoraddr(rowp, colp)
+ 	register int **rowp, **colp;
+ {
+ 	char buf[100];
+ 
+ 	/*
+ 	 * line# and column# are global in older proms (rom vector < 2)
+ 	 * and in some newer proms.  They are local in version 2.9.  The
+ 	 * correct cutoff point is unknown, as yet; we use 2.9 here.
+ 	 */
+ 	if (promvec->pv_romvec_vers < 2 || promvec->pv_printrev < 0x00020009)
+ 		sprintf(buf,
+ 		    "' line# >body >user %x ! ' column# >body >user %x !",
+ 		    rowp, colp);
+ 	else
+ 		sprintf(buf,
+ 		    "stdout @ is my-self addr line# %x ! addr column# %x !",
+ 		    rowp, colp);
+ 	*rowp = *colp = NULL;
+ 	rominterpret(buf);
+ 	return (*rowp == NULL || *colp == NULL);
+ }
+ #endif
+ 
  volatile void
  romhalt()
***************
*** 816,820 ****
  }
  
! static struct device *
  parsedisk(str, len, defpart, devp)
  	char *str;
--- 854,858 ----
  }
  
! struct device *
  parsedisk(str, len, defpart, devp)
  	char *str;
***************
*** 823,827 ****
  {
  	register struct device *dv;
! 	register char *cp;
  	int majdev, mindev, part;
  
--- 861,865 ----
  {
  	register struct device *dv;
! 	register char *cp, c;
  	int majdev, mindev, part;
  
***************
*** 829,839 ****
  		return (NULL);
  	cp = str + len - 1;
! 	if (*cp >= 'a' && *cp <= 'h') {
! 		part = *cp - 'a';
! 		*cp-- = '\0';
  	} else
  		part = defpart;
  
! 	for (dv = alldevs; dv != NULL; dv = dv->dv_next)
  		if (dv->dv_class == DV_DISK &&
  		    strcmp(str, dv->dv_xname) == 0) {
--- 867,878 ----
  		return (NULL);
  	cp = str + len - 1;
! 	c = *cp;
! 	if (c >= 'a' && c <= 'h') {
! 		part = c - 'a';
! 		*cp = '\0';
  	} else
  		part = defpart;
  
! 	for (dv = alldevs; dv != NULL; dv = dv->dv_next) {
  		if (dv->dv_class == DV_DISK &&
  		    strcmp(str, dv->dv_xname) == 0) {
***************
*** 843,850 ****
  			mindev = (dv->dv_unit << PARTITIONSHIFT) + part;
  			*devp = makedev(majdev, mindev);
! 			return (dv);
  		}
  
! 	return (NULL);
  }
  
--- 882,891 ----
  			mindev = (dv->dv_unit << PARTITIONSHIFT) + part;
  			*devp = makedev(majdev, mindev);
! 			break;
  		}
+ 	}
  
! 	*cp = c;
! 	return (dv);
  }
  
***************
*** 921,927 ****
  	case DV_IFNET:
  		mountroot = nfs_mountroot;
- #ifdef LBL
- 		lbl_diskless_setup();
- #endif
  		return;
  #endif
--- 962,965 ----

diff -r -c2 /nbsd/sys/sparc/sparc/cpu.c ./sparc/cpu.c
*** /nbsd/sys/sparc/sparc/cpu.c	Fri Jun 11 15:16:25 1993
--- ./sparc/cpu.c	Thu Sep 30 15:40:07 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)cpu.c	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: cpu.c,v 1.12 93/05/03 09:47:57 torek Exp $ (LBL)
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)cpu.c	8.3 (Berkeley) 9/30/93
   *
!  * from: $Header: cpu.c,v 1.16.1.1 93/09/30 22:38:50 torek Exp $ (LBL)
   */
  
***************
*** 51,54 ****
--- 51,55 ----
  #include <machine/cpu.h>
  #include <machine/reg.h>
+ #include <machine/trap.h>
  
  #include <sparc/sparc/cache.h>
***************
*** 57,70 ****
  struct cacheinfo cacheinfo;
  
! /* the following are used externally (sysctl_hw) */
  char	machine[] = "sparc";
! char	cpu_model[80];
  
! static char *psrtoname();
! static char *fsrtoname();
  
  /*
   * Attach the CPU.
!  * Discover interesting goop about the virtual address cache.
   */
  static void
--- 58,106 ----
  struct cacheinfo cacheinfo;
  
! /* The following are used externally (sysctl_hw). */
  char	machine[] = "sparc";
! char	cpu_model[100];
  
! /* The CPU configuration driver. */
! static void cpu_attach __P((struct device *, struct device *, void *));
  
+ struct cfdriver cpucd =
+     { NULL, "cpu", matchbyname, cpu_attach, DV_CPU, sizeof(struct device) };
+ 
+ static char *psrtoname __P((int, int, int, char *));
+ static char *fsrtoname __P((int, int, int, char *));
+ 
+ #define	IU_IMPL(psr)	((u_int)(psr) >> 28)
+ #define	IU_VERS(psr)	(((psr) >> 24) & 0xf)
+ 
+ #ifdef notdef
  /*
+  * IU implementations are parceled out to vendors (with some slight
+  * glitches).  Printing these is cute but takes too much space.
+  */
+ static char *iu_vendor[16] = {
+ 	"Fujitsu",	/* and also LSI Logic */
+ 	"ROSS",		/* ROSS (ex-Cypress) */
+ 	"BIT",
+ 	"LSIL",		/* LSI Logic finally got their own */
+ 	"TI",		/* Texas Instruments */
+ 	"Matsushita",
+ 	"Philips",
+ 	"Harvest",	/* Harvest VLSI Design Center */
+ 	"SPEC",		/* Systems and Processes Engineering Corporation */
+ 	"Weitek",
+ 	"vendor#10",
+ 	"vendor#11",
+ 	"vendor#12",
+ 	"vendor#13",
+ 	"vendor#14",
+ 	"vendor#15"
+ };
+ #endif
+ 
+ /*
   * Attach the CPU.
!  * Discover interesting goop about the virtual address cache
!  * (slightly funny place to do it, but this is where it is to be found).
   */
  static void
***************
*** 75,81 ****
  {
  	register int node, clk, i, l;
! 	register u_int psr, fver;
  	register char *fpuname;
  	struct fpstate fpstate;
  
  	/*
--- 111,118 ----
  {
  	register int node, clk, i, l;
! 	register int impl, vers, fver;
  	register char *fpuname;
  	struct fpstate fpstate;
+ 	char iubuf[40], fpbuf[40];
  
  	/*
***************
*** 91,98 ****
  	savefpstate(&fpstate);
  	fver = (fpstate.fs_fsr >> FSR_VER_SHIFT) & (FSR_VER >> FSR_VER_SHIFT);
! 	psr = getpsr();
  	if (fver != 7) {
  		foundfpu = 1;
! 		fpuname = fsrtoname(psr, fver);
  	} else
  		fpuname = "no";
--- 128,137 ----
  	savefpstate(&fpstate);
  	fver = (fpstate.fs_fsr >> FSR_VER_SHIFT) & (FSR_VER >> FSR_VER_SHIFT);
! 	i = getpsr();
! 	impl = IU_IMPL(i);
! 	vers = IU_VERS(i);
  	if (fver != 7) {
  		foundfpu = 1;
! 		fpuname = fsrtoname(impl, vers, fver, fpbuf);
  	} else
  		fpuname = "no";
***************
*** 102,107 ****
  	clk = getpropint(node, "clock-frequency", 0);
  	sprintf(cpu_model, "%s (%s @ %s MHz, %s FPU)",
! 	    getpropstring(node, "name"), psrtoname(psr),
! 	    clockfreq(clk), fpuname);
  	printf(": %s\n", cpu_model);
  
--- 141,146 ----
  	clk = getpropint(node, "clock-frequency", 0);
  	sprintf(cpu_model, "%s (%s @ %s MHz, %s FPU)",
! 	    getpropstring(node, "name"),
! 	    psrtoname(impl, vers, fver, iubuf), clockfreq(clk), fpuname);
  	printf(": %s\n", cpu_model);
  
***************
*** 119,206 ****
  		panic("bad cache line size %d", l);
  	cacheinfo.c_l2linesize = i;
  
! 	vactype = VAC_WRITETHROUGH;	/* ??? */
  }
  
! struct cfdriver cpucd =
!     { NULL, "cpu", matchbyname, cpu_attach, DV_CPU, sizeof(struct device) };
  
  static char *
! psrtoname(psr)
! 	register u_int psr;
  {
! 	int impl = psr >> 28, vers = (psr >> 24) & 15;
  
! 	switch (impl) {
  
! 	case 0:
! 		if (vers == 0)
! 			return ("MB86900/1A or L64801");
! 		break;
  
! 	case 1:
! 		if (vers < 2)
! 			return ("CY7C601 or L64811");
! 		if (vers == 3)
! 			return ("CY7C611");
! 		break;
  
! 	case 2:
! 		if (vers == 0)
! 			return ("B5010");
! 		break;
  
! 	case 5:
! 		if (vers == 0)
! 			return ("MN10501");
! 		break;
! 	}
! 	return ("???");
! }
  
! static char *
! fsrtoname(psr, fver)
! 	register u_int psr, fver;
! {
  
! 	switch (psr >> 28) {
  
! 	case 0:
! 		switch (fver) {
! 		case 0:
! 			return ("MB86910 or WTL1164/5");
! 		case 1:
! 			return ("MB86911 or WTL1164/5");
! 		case 2:
! 			return ("L64802 or ACT8847");
! 		case 3:
! 			return ("WTL3170/2");
! 		case 4:
! 			return ("L64804");
! 		}
! 		break;
  
! 	case 1:
! 		switch (fver) {
! 		case 0:
! 			return ("L64812 or ACT8847");
! 		case 1:
! 			return ("L64814");
! 		case 2:
! 			return ("TMS390C602A");
! 		case 3:
! 			return ("WTL3171");
! 		}
! 		break;
  
! 	case 2:
! 		if (fver == 0)
! 			return ("B5010 or B5110/20 or B5210");
! 		break;
  
! 	case 5:
! 		if (fver == 0)
! 			return ("MN10501");
! 	}
! 	return ("???");
  }
--- 158,289 ----
  		panic("bad cache line size %d", l);
  	cacheinfo.c_l2linesize = i;
+ 	vactype = VAC_WRITETHROUGH;
  
! 	/*
! 	 * Machines with "buserr-type" 1 have a bug in the cache
! 	 * chip that affects traps.  (I wish I knew more about this
! 	 * mysterious buserr-type variable....)
! 	 */
! 	if (getpropint(node, "buserr-type", 0) == 1) {
! 		kvm_uncache((caddr_t)trapbase, 1);
! 		printf("%s: cache chip bug; trap page uncached\n",
! 		    dev->dv_xname);
! 	}
! 
! 	printf("%s: %d byte write-through, %d bytes/line, %cw flush ",
! 	    dev->dv_xname, cacheinfo.c_totalsize, l,
! 	    cacheinfo.c_hwflush ? 'h' : 's');
! 	cache_enable();
  }
  
! /*
!  * The following tables convert <IU impl, IU version, FPU version> triples
!  * into names for the CPU and FPU chip.  In most cases we do not need to
!  * inspect the FPU version to name the IU chip, but there is one exception
!  * (for Tsunami), and this makes the tables the same.
!  *
!  * The table contents (and much of the structure here) are from Guy Harris.
!  *
!  * NOTE: we have Sun-4m cpu types here, even though this only runs on the
!  * Sun-4c (yet)...
!  */
! struct info {
! 	u_char	valid;
! 	u_char	iu_impl;
! 	u_char	iu_vers;
! 	u_char	fpu_vers;
! 	char	*name;
! };
  
+ #define	ANY	0xff	/* match any FPU version (or, later, IU version) */
+ 
+ static struct info iu_types[] = {
+ 	{ 1, 0x0, 0x0, ANY, "MB86900/1A or L64801" },
+ 	{ 1, 0x1, 0x0, ANY, "RT601 or L64811 v1" },
+ 	{ 1, 0x1, 0x1, ANY, "RT601 or L64811 v2" },
+ 	{ 1, 0x1, 0x3, ANY, "RT611" },
+ 	{ 1, 0x1, 0xf, ANY, "RT620" },
+ 	{ 1, 0x2, 0x0, ANY, "B5010" },
+ 	{ 1, 0x4, 0x0,   0, "TMS390Z50 v0" },
+ 	{ 1, 0x4, 0x1,   0, "TMS390Z50 v1" },
+ 	{ 1, 0x4, 0x1,   4, "TMS390S10" },
+ 	{ 1, 0x5, 0x0, ANY, "MN10501" },
+ 	{ 1, 0x9, 0x0, ANY, "W8601/8701 or MB86903" },
+ 	{ 0 }
+ };
+ 
  static char *
! psrtoname(impl, vers, fver, buf)
! 	register int impl, vers, fver;
! 	char *buf;
  {
! 	register struct info *p;
  
! 	for (p = iu_types; p->valid; p++)
! 		if (p->iu_impl == impl && p->iu_vers == vers &&
! 		    (p->fpu_vers == fver || p->fpu_vers == ANY))
! 			return (p->name);
  
! 	/* Not found. */
! 	sprintf(buf, "IU impl 0x%x vers 0x%x", impl, vers);
! 	return (buf);
! }
  
! /* NB: table order matters here; specific numbers must appear before ANY. */
! static struct info fpu_types[] = {
! 	/*
! 	 * Vendor 0, IU Fujitsu0.
! 	 */
! 	{ 1, 0x0, ANY, 0, "MB86910 or WTL1164/5" },
! 	{ 1, 0x0, ANY, 1, "MB86911 or WTL1164/5" },
! 	{ 1, 0x0, ANY, 2, "L64802 or ACT8847" },
! 	{ 1, 0x0, ANY, 3, "WTL3170/2" },
! 	{ 1, 0x0, ANY, 4, "L64804" },
  
! 	/*
! 	 * Vendor 1, IU ROSS0/1.
! 	 */
! 	{ 1, 0x1, ANY, 0, "L64812 or ACT8847" },
! 	{ 1, 0x1, ANY, 1, "L64814" },
! 	{ 1, 0x1, ANY, 2, "TMS390C602A" },
! 	{ 1, 0x1, ANY, 3, "RT602 or WTL3171" },
  
! 	/*
! 	 * Vendor 2, IU BIT0.
! 	 */
! 	{ 1, 0x2, ANY, 0, "B5010 or B5110/20 or B5210" },
  
! 	/*
! 	 * Vendor 4, Texas Instruments.
! 	 */
! 	{ 1, 0x4, ANY, 0, "on-chip" },		/* Viking */
! 	{ 1, 0x4, ANY, 4, "on-chip" },		/* Tsunami */
  
! 	/*
! 	 * Vendor 5, IU Matsushita0.
! 	 */
! 	{ 1, 0x5, ANY, 0, "on-chip" },
  
! 	/*
! 	 * Vendor 9, Weitek.
! 	 */
! 	{ 1, 0x9, ANY, 3, "on-chip" },
  
! 	{ 0 }
! };
  
! static char *
! fsrtoname(impl, vers, fver, buf)
! 	register int impl, vers, fver;
! 	char *buf;
! {
! 	register struct info *p;
  
! 	for (p = fpu_types; p->valid; p++)
! 		if (p->iu_impl == impl &&
! 		    (p->iu_vers == vers || p->iu_vers == ANY) &
! 		    p->fpu_vers == fver)
! 			return (p->name);
! 	sprintf(buf, "version %x", fver);
! 	return (buf);
  }

diff -r -c2 /nbsd/sys/sparc/sparc/intr.c ./sparc/intr.c
*** /nbsd/sys/sparc/sparc/intr.c	Fri Jun 11 15:16:33 1993
--- ./sparc/intr.c	Mon Sep 27 14:02:53 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)intr.c	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: intr.c,v 1.20 92/11/26 03:04:53 torek Exp $ (LBL)
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)intr.c	8.2 (Berkeley) 9/27/93
   *
!  * from: $Header: intr.c,v 1.22 93/09/26 19:48:06 torek Exp $ (LBL)
   */
  
***************
*** 48,51 ****
--- 48,53 ----
  #include <sys/kernel.h>
  
+ #include <vm/vm.h>
+ 
  #include <net/netisr.h>
  
***************
*** 73,77 ****
  	    fp->ipl, fp->pc, fp->npc, fp->psr, PSR_BITS);
  	timesince = time.tv_sec - straytime;
- 	straytime = time.tv_sec;
  	if (timesince <= 10) {
  		if (++nstray > 9)
--- 75,78 ----
***************
*** 251,257 ****
--- 252,262 ----
  		    I_MOVi(I_L3, level), I_BA(0, displ), I_RDPSR(I_L0));
  #endif
+ 	/* kernel text is write protected -- let us in for a moment */
+ 	pmap_changeprot(kernel_pmap, (vm_offset_t)tv,
+ 	    VM_PROT_READ|VM_PROT_WRITE, 1);
  	tv->tv_instr[0] = I_SETHI(I_L3, hi22);	/* sethi %hi(vec),%l3 */
  	tv->tv_instr[1] = I_JMPLri(I_G0, I_L3, lo10);/* jmpl %l3+%lo(vec),%g0 */
  	tv->tv_instr[2] = I_RDPSR(I_L0);	/* mov %psr, %l0 */
+ 	pmap_changeprot(kernel_pmap, (vm_offset_t)tv, VM_PROT_READ, 1);
  	fastvec |= 1 << level;
  	splx(s);

diff -r -c2 /nbsd/sys/sparc/sparc/machdep.c ./sparc/machdep.c
*** /nbsd/sys/sparc/sparc/machdep.c	Fri Jun 11 15:17:03 1993
--- ./sparc/machdep.c	Thu Sep 30 15:41:39 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)machdep.c	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: machdep.c,v 1.41 93/05/27 04:39:05 torek Exp $
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)machdep.c	8.2 (Berkeley) 9/30/93
   *
!  * from: $Header: machdep.c,v 1.42 93/09/29 05:40:34 torek Exp $
   */
  
***************
*** 222,234 ****
  
  	/*
! 	 * Configure the system.
  	 */
  	configure();
- 
- 	/*
- 	 * Turn on the cache (do after configuration due to a bug in
- 	 * some versions of the SPARC chips -- this info from Gilmore).
- 	 */
- 	cache_enable();
  }
  
--- 222,228 ----
  
  	/*
! 	 * Configure the system.  The cpu code will turn on the cache.
  	 */
  	configure();
  }
  
diff -r -c2 /nbsd/sys/sparc/sparc/pmap.c ./sparc/pmap.c
*** /nbsd/sys/sparc/sparc/pmap.c	Fri Jun 11 15:17:25 1993
--- ./sparc/pmap.c	Mon Sep 27 14:04:45 1993
***************
*** 40,46 ****
   * SUCH DAMAGE.
   *
!  *	@(#)pmap.c	8.1 (Berkeley) 6/11/93
   *
!  * from: $Header: pmap.c,v 1.39 93/04/20 11:17:12 torek Exp $
   */
  
--- 40,46 ----
   * SUCH DAMAGE.
   *
!  *	@(#)pmap.c	8.2 (Berkeley) 9/27/93
   *
!  * from: $Header: pmap.c,v 1.40 93/09/27 19:20:44 torek Exp $
   */
  
***************
*** 344,347 ****
--- 344,375 ----
  #define	SWTOHW(pg) (pmap_dtos[(pg) >> BSHIFT] | ((pg) & BOFFSET))
  
+ /*
+  * Sort a memory array by address.
+  */
+ static void
+ sortm(mp, n)
+ 	register struct memarr *mp;
+ 	register int n;
+ {
+ 	register struct memarr *mpj;
+ 	register int i, j;
+ 	register u_int addr, len;
+ 
+ 	/* Insertion sort.  This is O(n^2), but so what? */
+ 	for (i = 1; i < n; i++) {
+ 		/* save i'th entry */
+ 		addr = mp[i].addr;
+ 		len = mp[i].len;
+ 		/* find j such that i'th entry goes before j'th */
+ 		for (j = 0, mpj = mp; j < i; j++, mpj++)
+ 			if (addr < mpj->addr)
+ 				break;
+ 		/* slide up any additional entries */
+ 		ovbcopy(mpj, mpj + 1, (i - j) * sizeof(*mp));
+ 		mpj->addr = addr;
+ 		mpj->len = len;
+ 	}
+ }
+ 
  #ifdef DEBUG
  struct	memarr pmap_ama[MA_SIZE];
***************
*** 366,369 ****
--- 394,412 ----
  
  	nmem = makememarr(ama, MA_SIZE, MEMARR_AVAILPHYS);
+ 
+ 	/*
+ 	 * Open Boot supposedly guarantees at least 3 MB free mem at 0;
+ 	 * this is where the kernel has been loaded (we certainly hope the
+ 	 * kernel is <= 3 MB).  We need the memory array to be sorted, and
+ 	 * to start at 0, so that `software page 0' and `hardware page 0'
+ 	 * are the same (otherwise the VM reserves the wrong pages for the
+ 	 * kernel).
+ 	 */
+ 	sortm(ama, nmem);
+ 	if (ama[0].addr != 0) {
+ 		/* cannot panic here; there's no real kernel yet. */
+ 		printf("init_translations: no kernel memory?!\n");
+ 		callrom();
+ 	}
  #ifdef DEBUG
  	pmap_nama = nmem;