Subject: kern/801: wddump() doesn't work on i386; patch included
To: None <gnats-admin@NetBSD.ORG>
From: Lon Willett <lon%softt.uucp@math.utah.edu>
List: netbsd-bugs
Date: 02/14/1995 18:20:10
>Number:         801
>Category:       kern
>Synopsis:       system dumps created by wddump() are bogus; patch included
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 14 18:20:09 1995
>Originator:     Lon Willett
>Organization:
>Release:        NetBSD-current 14 Feb 95
>Environment:

i386, isa wd disk, 24MB memory

System: NetBSD hilly 1.0A NetBSD 1.0A (HILLY) #106: Mon Feb 13 16:14:32 MST 1995 lon@hilly:/usr/src/sys/arch/i386/compile/HILLY i386

>Description:

	wddump() writes totally bogus system dumps for the i386
	architecture when the kernel panics, due to it's mishandling of
	memory mapping.  I have included a patch which "fixes" the
	problem for the i386, but breaks it for other architectures for
	on which it might currently work.

	This patch is obviously not meant to be included in the source,
	but is just provided to show the nature of the problem.  The
	xxdump() code really needs to be restructured (add a function to
	"pmap.c" for the differing architectures?).  Do any versions of
	it work?  But, at the very least, wddump() should be modified to
	print a "not implemented" message and exit.

	System dumps don't really seem to work anyway; even after I got
	a seemingly more or less valid dump, I was unable to do anything
	useful with it (libkvm problems?), but have not had the time to
	look into this further.  I imagine that people are aware of this
	problem, so I am not submitting a separate bug report for it.

>How-To-Repeat:

	On an Intel box using a wd disk for swap, try something like:

	Ctrl-Alt-Esc
	ddb> call panic(version)
	...
	ddb> continue
	...
	(garbage dumped to wd0b)

	On reboot, savecore won't give create a dump.

>Fix:

Here's the patch; you did read the above comments, didn't you?

--- usr/src/sys/dev/isa/wd.c.orig	Sun Jan 29 00:37:15 1995
+++ usr/src/sys/dev/isa/wd.c	Mon Feb 13 07:34:38 1995
@@ -1549,8 +1549,13 @@
 #ifdef notdef	/* Cannot use this since this address was mapped differently. */
 		pmap_enter(kernel_pmap, CADDR1, trunc_page(addr), VM_PROT_READ, TRUE);
 #else
+#if 1 /* i386 */
+		*CMAP1 = PG_V | PG_KW | (long)addr&PG_FRAME;
+		pmap_update();
+#else /* pc532, others? */
 		*CMAP1 = PG_V | PG_KW | ctob((long)addr);
 		tlbflush();
+#endif
 #endif
 	
 		outsw(wdc->sc_iobase+wd_data, CADDR1 + ((int)addr & PGOFSET),
>Audit-Trail:
>Unformatted: