Re: Can't boot alpha and mips(Re: Can't boot SGI O2)

Nicolas Joly <[email protected]> Wed, 15 May 2013 18:26:56 +0200
Newsgroups gmane.os.netbsd.ports.alpha,gmane.os.netbsd.current,gmane.os.netbsd.ports.mips.devel,gmane.os.netbsd.ports.sgimips
Organization Institut Pasteur, Paris.
Message-ID <[email protected]>
On Tue, Apr 30, 2013 at 10:11:24PM +0900, KIYOHARA Takashi wrote:
[...]
> > How we avoid this problem?
> 
> Also can't boot alpha machine.
> 
>   arch/alpha/alpha/machdep.c:alpha_init()
>     arch/alpha/alpha/pmap.c:pmap_bootstrap()
>       kern/vfs_bio.c:buf_memcalc()
>         :

Hi,

The attached patch makes my PWS500au alpha boot again by restoring the
case where buf_map is not yet mapped when called early from
pmap_bootstrap().

-- 
Nicolas Joly

Biology IT Center
Institut Pasteur, Paris.
netbsd-bufmemcalc.diff (text/plain, 831 B)
Index: sys/kern/vfs_bio.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_bio.c,v
retrieving revision 1.243
diff -u -p -r1.243 vfs_bio.c
--- sys/kern/vfs_bio.c	18 Mar 2013 13:36:22 -0000	1.243
+++ sys/kern/vfs_bio.c	15 May 2013 13:23:34 -0000
@@ -396,7 +396,7 @@ u_long
 buf_memcalc(void)
 {
 	u_long n;
-	vsize_t mapsz;
+	vsize_t mapsz = 0;
 
 	/*
 	 * Determine the upper bound of memory to use for buffers.
@@ -418,7 +418,8 @@ buf_memcalc(void)
 			printf("forcing bufcache %d -> 95", bufcache);
 			bufcache = 95;
 		}
-		mapsz = vm_map_max(buf_map) - vm_map_min(buf_map);
+		if (buf_map != NULL)
+			mapsz = vm_map_max(buf_map) - vm_map_min(buf_map);
 		n = calc_cache_size(mapsz, bufcache,
 		    (buf_map != kernel_map) ? 100 : BUFCACHE_VA_MAXPCT)
 		    / PAGE_SIZE;