Subject: port-i386/4832: Ramdisk kernel
To: None <gnats-bugs@gnats.netbsd.org>
From: Anshul Kantawala <anshul@clouseau.arl.wustl.edu>
List: netbsd-bugs
Date: 01/16/1998 14:52:57
>Number:         4832
>Category:       port-i386
>Synopsis:       4MB temp kernel mapping too small for large ramdisk kernels
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 16 13:05:00 1998
>Last-Modified:
>Originator:     Anshul Kantawala
>Organization:
Washington University
>Release:        NetBSD 1.3_BETA chuck@graceland.arl.wustl.edu:/a/pain/1.3/src/sys/arch/i386/compile/DEMAND i386 Dec 10 20:19:49 CST 1997
>Environment:
Pentium-100 Mhz, NetBSD 1.3_BETA
System: NetBSD clouseau.arl.wustl.edu 1.3_BETA NetBSD 1.3_BETA (DEMAND) #0: Wed Dec 10 20:19:49 CST 1997 chuck@graceland.arl.wustl.edu:/a/pain/1.3/src/sys/arch/i386/compile/DEMAND i386


>Description:
	4MB temp kernel mapping too small for large ramdisk kernels.
	It causes a crash when enabling paging.

>How-To-Repeat:
	Build kernel with root memory-disk and set 
options         MINIROOTSIZE=8000     # size of memory disk, in blocks
(any size that'll produce a total kernel image of > 4MB)

>Fix:
	Hack to fix the problem is described below.  It would be much 
	appreciated if we could get a "clean" fix of the problem.

	(Quick fix developed by Chuck Cranor --
	helped by Matthias Drochner and Chris G. Demetriou)

	*** locore.s_REAL	Fri Jan 16 13:39:38 1998
--- locore.s	Fri Jan 16 13:59:18 1998
***************
*** 566,572 ****
   */
  	/* Install a PDE for temporary double map of kernel text. */
  	leal	(SYSMAP+PG_V|PG_KW)(%esi),%eax		# pte for KPT in proc 0,
! 	movl	%eax,(PROC0PDIR+0*4)(%esi)		# which is where temp maps!
  	/* Map kernel PDEs. */
  	movl	RELOC(_nkpde),%ecx			# for this many pde s,
  	leal	(PROC0PDIR+KPTDI*4)(%esi),%ebx		# offset of pde for kernel
--- 566,578 ----
   */
  	/* Install a PDE for temporary double map of kernel text. */

  	leal	(SYSMAP+PG_V|PG_KW)(%esi),%eax		# pte for KPT in proc 0,
! 	movl	%eax,(PROC0PDIR+0*4)(%esi)	# which is where temp maps!
! 
! 	addl	$NBPG,%eax			# ADD TO EAX
! 	movl	%eax,(PROC0PDIR+1*4)(%esi)	# TMP MAP MB 4-8 
! 	leal	(SYSMAP+PG_V|PG_KW)(%esi),%eax	# RESET EAX FOR BELOW
! 
! 	
  	/* Map kernel PDEs. */
  	movl	RELOC(_nkpde),%ecx			# for this many pde s,
  	leal	(PROC0PDIR+KPTDI*4)(%esi),%ebx		# offset of pde for kernel


that adds 4MB more to the tmp mapping.   note that this fix is a 
quick _hack_.  it will not work if you have NBIOSCALL set to 1.
(look at bioscall.h in your compile directory...).
>Audit-Trail:
>Unformatted: