Subject: pmap_extract vs. P1 and P2 addresses (port-sh3/26569)
To: None <port-sh3@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-sh3
Date: 02/09/2006 00:23:47
--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Attached patch fixes port-sh3/26569.  The problem is that sh3 defines

    #define	PMAP_MAP_POOLPAGE(pa) SH3_PHYS_TO_P1SEG((pa))

and when pmap_extract is called on that P1 address we lose.

Can anyone think of why the attached fix might be a bad idea?  Do we
need something more elaborate (b/c I miss something about sh3 pmap),
or is the wildcard P1/P2 test there is ok?

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen

--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pmap.c-diff"

Index: pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sh3/sh3/pmap.c,v
retrieving revision 1.52
diff -u --unified -r1.52 pmap.c
--- pmap.c	21 Jan 2006 00:56:05 -0000	1.52
+++ pmap.c	8 Feb 2006 21:17:35 -0000
@@ -585,8 +585,16 @@
 boolean_t
 pmap_extract(pmap_t pmap, vaddr_t va, paddr_t *pap)
 {
-	pt_entry_t *pte = __pmap_pte_lookup(pmap, va);
+	pt_entry_t *pte;
+
+	/* handle P1 and P2 specially: va == pa */
+	if (pmap == pmap_kernel() && (va >> 30) == 2) {
+		if (pap != NULL)
+			*pap = va & SH3_PHYS_MASK;
+		return (TRUE);
+	}
 
+	pte = __pmap_pte_lookup(pmap, va);
 	if (pte == NULL || *pte == 0)
 		return (FALSE);
 

--PNTmBPCT7hxwcZjr--