Subject: port-i386/647: bogus kernel crash dumps on i386
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: netbsd-bugs
Date: 12/17/1994 17:20:05
>Number:         647
>Category:       port-i386
>Synopsis:       crash dumps on i386 to wd are bogus
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 17 17:20:02 1994
>Originator:     John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release:        1.0
>Environment:
	
System: NetBSD kolvir 1.0A NetBSD 1.0A (KOLVIR) #36: Sat Dec 17 08:26:43 EST 1994 jtk@kolvir:/u1/NetBSD-current/src/sys/arch/i386/compile/KOLVIR i386


>Description:
crash dumps to wd drives are broken.  The attempt to set up memory
mapping to go through all pages in memory is incorrect.

>How-To-Repeat:
Try to savecore from a crashdump on a wd drive.

>Fix:

--- 1.1	1994/12/18 00:48:29
+++ wd.c	1994/12/18 00:49:13
@@ -1433,6 +1433,7 @@
 	int unit, part;
 	long rblkno, nblks;
 	char *addr;
+	vm_offset_t lastframe = (vm_offset_t) -1;
 	static wddoingadump = 0;
 	extern caddr_t CADDR1;
 	extern pt_entry_t *CMAP1;
@@ -1525,8 +1526,12 @@
 #ifdef notdef	/* Cannot use this since this address was mapped differently. */
 		pmap_enter(kernel_pmap, CADDR1, trunc_page(addr), VM_PROT_READ, TRUE);
 #else
-		*CMAP1 = PG_V | PG_KW | ctob((long)addr);
-		tlbflush();
+		if (((vm_offset_t)addr & PG_FRAME) != lastframe) {
+		    /* first DEV_BSIZE block in a new page frame */
+		    *CMAP1 = PG_V | PG_KW | ((vm_offset_t)addr & PG_FRAME);
+		    tlbflush();
+		    lastframe = (vm_offset_t)addr & PG_FRAME;
+		}
 #endif
 	
 		outsw(wdc->sc_iobase+wd_data, CADDR1 + ((int)addr & PGOFSET),
>Audit-Trail:
>Unformatted: