Subject: port-i386/2859: pmap.c still has some problems
To: None <gnats-bugs@gnats.netbsd.org>
From: Mike Long <mike.long@analog.com>
List: netbsd-bugs
Date: 10/18/1996 02:58:50
>Number:         2859
>Category:       port-i386
>Synopsis:       pmap.c still has some problems
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 18 00:20:03 1996
>Last-Modified:
>Originator:     Mike Long <mike.long@analog.com>
>Organization:
	Eh?
>Release:        1.2A
>Environment:
System: NetBSD azathoth 1.2A NetBSD 1.2A (AZATHOTH) #0: Wed Oct 16 04:29:54 EDT 1996 root@azathoth:/usr/src/sys/arch/i386/compile/AZATHOTH i386

>Description:
	/sys/arch/i386/i386/pmap.c still breaks in some ways if your kernel
config contains "options DEBUG":

1) some printf formats don't match object types (in commented-out code)
2) pmap_collect() spews regardless of PDB_COLLECT

As a bonus, I also found a typo in pmap_release():
DIAGNOSTICx -> DIAGNOSTIC.

>How-To-Repeat:
	Build an i386 kernel with "options DEBUG" and "options DIAGNOSTIC".
>Fix:
	Apply the patch below.

*** src/sys/arch/i386/i386/pmap.c.orig	Thu Oct 17 07:18:18 1996
--- src/sys/arch/i386/i386/pmap.c	Fri Oct 18 02:52:43 1996
***************
*** 685,689 ****
  #endif
  
! #ifdef DIAGNOSTICx
  	/* sometimes 1, sometimes 0; could rearrange pmap_destroy */
  	if (pmap->pm_count != 1)
--- 685,689 ----
  #endif
  
! #ifdef DIAGNOSTIC
  	/* sometimes 1, sometimes 0; could rearrange pmap_destroy */
  	if (pmap->pm_count != 1)
***************
*** 1375,1379 ****
  {
  #ifdef DEBUG
! 	printf("pmap_collect(%p) ", pmap);
  #endif
  
--- 1375,1380 ----
  {
  #ifdef DEBUG
! 	if (pmapdebug & PDB_COLLECT)
! 		printf("pmap_collect(%p)\n", pmap);
  #endif
  
***************
*** 1393,1397 ****
  	if (!pmap_initialized)
  		return;
! 	printf("%s %08x:", m, phys);
  	pv = &pv_table[pmap_page_index(phys)];
  	if (pv->pv_pmap == NULL) {
--- 1394,1398 ----
  	if (!pmap_initialized)
  		return;
! 	printf("%s %08lx:", m, phys);
  	pv = &pv_table[pmap_page_index(phys)];
  	if (pv->pv_pmap == NULL) {
***************
*** 1400,1404 ****
  	}
  	for (; pv; pv = pv->pv_next)
! 		printf(" pmap %08x va %08x", pv->pv_pmap, pv->pv_va);
  	printf("\n");
  }
--- 1401,1405 ----
  	}
  	for (; pv; pv = pv->pv_next)
! 		printf(" pmap %08p va %08lx", pv->pv_pmap, pv->pv_va);
  	printf("\n");
  }
***************
*** 1525,1529 ****
  #ifdef needsomethinglikethis
  		if (pmapdebug & PDB_PTPAGE)
! 			printf("pmap_pageable: PT page %x(%x) unmodified\n",
  			       sva, *pmap_pte(pmap, sva));
  		if (pmapdebug & PDB_WIRING)
--- 1526,1530 ----
  #ifdef needsomethinglikethis
  		if (pmapdebug & PDB_PTPAGE)
! 			printf("pmap_pageable: PT page %lx(%lx) unmodified\n",
  			       sva, *pmap_pte(pmap, sva));
  		if (pmapdebug & PDB_WIRING)
***************
*** 1683,1687 ****
  
  	if (!vm_map_lookup_entry(pt_map, va, &entry)) {
! 		printf("wired_check: entry for %x not found\n", va);
  		return;
  	}
--- 1684,1688 ----
  
  	if (!vm_map_lookup_entry(pt_map, va, &entry)) {
! 		printf("wired_check: entry for %lx not found\n", va);
  		return;
  	}
***************
*** 1691,1695 ****
  			count++;
  	if (entry->wired_count != count)
! 		printf("*%s*: %x: w%d/a%d\n",
  		       str, va, entry->wired_count, count);
  }
--- 1692,1696 ----
  			count++;
  	if (entry->wired_count != count)
! 		printf("*%s*: %lx: w%d/a%d\n",
  		       str, va, entry->wired_count, count);
  }

>Audit-Trail:
>Unformatted: