Subject: Re: panic: uvm_page_physload: start >= end
To: None <manu@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-macppc
Date: 03/31/2002 11:54:09
In article <1f9vwh1.102m3fu114cxhtM@[10.0.12.137]>
manu@netbsd.org wrote:

> > I guess the real problem is that OF returns unaligned regions in
> > powerpc/ofw_machdep.c:mem_region() and pmap does not handle it.
> > My patch is just workaround, not fix.
> 
> Well at least it makes -current kernels bootable on my machine and
> yours. That's better than a workaround...

As noted in the NetBSD goals page, "It doesn't work unless it's right."

pmap_bootstrap() would still pass wrong values to uvm_page_physload(),
and actually quick hacks often put off comming proper fix ;-p

Anyway, I guess the attached patch would be a "right" fix,
but it should be approved by powerpc or vm guys.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp

Index: pmap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/powerpc/mpc6xx/pmap.c,v
retrieving revision 1.38
diff -u -r1.38 pmap.c
--- pmap.c	2002/03/08 20:48:33	1.38
+++ pmap.c	2002/03/31 02:44:00
@@ -2643,8 +2643,8 @@
 	kernelstart = trunc_page(kernelstart);
 	kernelend = round_page(kernelend);
 	for (mp = avail, i = 0; i < avail_cnt; i++, mp++) {
-		s = trunc_page(mp->start);
-		e = round_page(mp->start + mp->size);
+		s = round_page(mp->start);
+		e = trunc_page(mp->start + mp->size);
 
 		DPRINTFN(BOOT,
 		    ("pmap_bootstrap: b-avail[%d] start 0x%lx size 0x%lx\n",
@@ -2666,6 +2666,7 @@
 				avail[avail_cnt].size = e - kernelend;
 				avail_cnt++;
 			}
+			mp->start = s;
 			mp->size = kernelstart - s;
 		}
 		/*