Subject: port-i386/5474: UVM/PMAP_NEW on i386 panics
To: None <gnats-bugs@gnats.netbsd.org>
From: Stefan Grefen <grefen@hprc.tandem.com>
List: netbsd-bugs
Date: 05/20/1998 22:45:31
>Number:         5474
>Category:       port-i386
>Synopsis:       UVM/PMAP_NEW on i386 panics
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 20 14:05:01 1998
>Last-Modified:
>Originator:     Stefan Grefen
>Organization:
Stefan Grefen                                Tandem Computers Europe Inc.
grefen@hprc.tandem.com                       High Performance Research Center
 --- Hacking's just another word for nothing left to kludge. ---
>Release:        today <NetBSD-current source date>
>Environment:
	
System: NetBSD hrriss 1.3B NetBSD 1.3B (HRRISS) #7: Wed Feb 11 18:47:17 GMT 1998 grefen@hrriss:/usr/src/sys/arch/i386/compile/HRRISS i386


>Description:
	 UVM/PMAP_NEW on i386 panics 
	 This just to send-pr the fix
	
>How-To-Repeat:
	
>Fix:
*** trap.c	Thu Mar  5 13:20:21 1998
--- /homes/grefen/trap.c	Wed May 20 22:07:28 1998
***************
*** 442,447 ****
--- 442,479 ----
  		/* Fault the original page in. */
  #if defined(UVM)
  		rv = uvm_fault(map, va, 0, ftype);
+ 
+ #if defined(I386_CPU)
+ 		/*
+ 		 * Now comes a realy ugly hack.
+ 		 * This can happen if copyout trys to 
+ 		 * check access for zfod and the 
+ 		 * pde entry is not yet there.
+ 		 * We do a very accurate check for this 
+ 		 * and than simultae a failure for the 
+ 		 * write test.
+ 		 * we could move that in front of the
+ 		 * uvm_fault above for performance reasons.
+ 		 * 
+ 		 * Stefan Grefen grefen@carpe.net
+ 		 */
+ 		if(rv 					/* mapping failed */
+ 		    && map!=kernel_map 			/* user process   */
+ 		    && va>=(vm_offset_t)PTE_BASE 	/* page table range*/
+ 		    && va<(vm_offset_t)PDP_BASE 	/*   ""		  */
+ 		    && pcb->pcb_onfault 		/* copyout and friends*/
+ #if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)
+ 		    && cpu_class==CPUCLASS_386          /* 386 CPU active */
+ #endif
+ 		) {
+ 		    int pde=*(int *)(vtopte(va));	/* get the pde */
+ 		    if(pde==0) {			/* pte page missing */
+ 			frame.tf_eflags|=PSL_Z;		/* testb return zero */
+ 		        frame.tf_eip += 8;		/* Yuck .... */
+ 			return;				/* done */
+ 		    }
+ 		}
+ #endif
  #else
  		rv = vm_fault(map, va, ftype, FALSE);
  #endif
	
>Audit-Trail:
>Unformatted: