Subject: Re: pmap panic with 11/17 kernel
To: None <nathanw@mit.edu>
From: Gordon W. Ross <gwr@mc.com>
List: port-sun3
Date: 11/18/1997 14:06:09
> From: "Nathan J. Williams" <nathanw@mit.edu>
> Date: Tue, 18 Nov 1997 10:45:24 EST
> 
> 	I built a new kernel from 11/17 sources yesterday, to replace
> the 11/3 kernel I was using before. If I've been reading the messages
> properly, this is my first kernel with the new pmap code in it. It
> seemed to work, making it most of the way through boot, but right
> after I got the log message of "kernel security level changing from 0
> to 1", it paniced:
> 
> panic: pmap_to_pvflags: idx=0x7f800
[...]
> 	I still have the corefile, if there's more useful debugging I
> can do. Ideas? It's clearly from a DIAGNOSTIC check, so there's a real
> problem here somewhere.
> 
> 	- Nathan

That was a very helpful bug report.  Thanks very much!
I'm too busy to test this, but this should fix it:
(Could you please let me know if it does ASAP?)

*** pmap.c~	Mon Nov  3 17:47:18 1997
--- pmap.c	Tue Nov 18 14:03:05 1997
***************
*** 2642,2652 ****
  {
  	register pv_entry_t	*head;
  	u_char *pv_flags;
! 	int s;
  
  	if (!pv_initialized)
  		return;
  
  	pv_flags = pa_to_pvflags(pa);
  	head     = pa_to_pvhead(pa);
  
--- 2642,2657 ----
  {
  	register pv_entry_t	*head;
  	u_char *pv_flags;
! 	int idx, s;
  
  	if (!pv_initialized)
  		return;
  
+ 	/* Ugh!  The VM code calls this on device addresses! */
+ 	idx = PA_PGNUM(pa);
+ 	if (idx > physmem)
+ 		return;
+ 
  	pv_flags = pa_to_pvflags(pa);
  	head     = pa_to_pvhead(pa);