Subject: Re: I got panic on KASSERT(pg) with uvm_km.c
To: Hiroki Minematu <minematu@aimcom.co.jp>
From: Chuck Silvers <chuq@chuq.com>
List: current-users
Date: 11/12/2001 23:31:14
--J2SCkAp4GZ/dPZZf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

hi,

please try the attached patch.

-Chuck


On Tue, Nov 13, 2001 at 12:21:42PM +0900, Hiroki Minematu wrote:
> Hello!
> 
>  I got panic with KASSERT(pg) on uvm_km_pgremove_intrsafe function
> (uvm_km.c line 343). So, it results from that pmap_extract function 
> return `pa' with NULL value, does any other arch'es get such a 
> kernel panic?
> 
>  I'm now under work with NetBSD/sh (evbsh3) on my eva board that
> mount SH4(7790S) and simple serial port.  It is different from
> basic EVBSH3's that IOM_RAM_BEGIN=0x88000000. 
>  So, I only make some changes on sci.c against some compile errors.
> (where is SHREG_SCSPTR defined?)
> 
>  Is it different behavior against any other EBVSH3's ?
> (mmeyes, dreamcast)
> 
> ------------------------+
> Hiroki MINEMATU/Aimcom  |
> minematu@aimcom.co.jp   |

--J2SCkAp4GZ/dPZZf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="diff.sh3-pmap"

Index: arch/sh3/sh3/pmap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sh3/sh3/pmap.c,v
retrieving revision 1.28
diff -u -r1.28 pmap.c
--- arch/sh3/sh3/pmap.c	2001/09/19 07:54:48	1.28
+++ arch/sh3/sh3/pmap.c	2001/11/13 07:29:38
@@ -1738,18 +1738,21 @@
 	vaddr_t va;
 	paddr_t *pap;
 {
-	paddr_t retval;
-	pt_entry_t *ptes;
+	pt_entry_t *ptes, pte;
 
-	if (pmap->pm_pdir[pdei(va)]) {
-		ptes = pmap_map_ptes(pmap);
-		retval = (paddr_t)(ptes[sh3_btop(va)] & PG_FRAME);
-		pmap_unmap_ptes(pmap);
-		if (pap != NULL)
-			*pap = retval | (va & ~PG_FRAME);
-		return (TRUE);
+	if (pmap->pm_pdir[pdei(va)] == 0) {
+		return (FALSE);
 	}
-	return (FALSE);
+	ptes = pmap_map_ptes(pmap);
+	pte = ptes[sh3_btop(va)];
+	pmap_unmap_ptes(pmap);
+	if ((pte & PG_V) == 0) {
+		return (FALSE);
+	}
+	if (pap != NULL) {
+		*pap = (pte & PG_FRAME) | (va & ~PG_FRAME);
+	}
+	return (TRUE);
 }
 
 

--J2SCkAp4GZ/dPZZf--