NetBSD Problem Report #1931

From gnats  Thu Jan 11 15:37:49 1996
Received: from arhpc214.uni-c.dk by pain.lcs.mit.edu (8.6.12/8.6.9) with ESMTP id PAA20926 for <gnats-bugs@gnats.netbsd.org>; Thu, 11 Jan 1996 15:24:08 -0500
Message-Id: <199601112124.WAA02705@arhpc214.uni-c.dk>
Date: Thu, 11 Jan 1996 22:24:26 +0100
From: Erik Bertelsen <erik@arhpc214.uni-c.dk>
Reply-To: erik@sockdev.uni-c.dk
To: gnats-bugs@gnats.netbsd.org
Subject: option DEBUG causes kernel compilation failure on mac68k
X-Send-Pr-Version: 3.95

>Number:         1931
>Category:       port-mac68k
>Synopsis:       option DEBUG causes kernel compilation failure on mac68k
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 11 15:50:02 +0000 1996
>Closed-Date:    Fri Jan 12 04:19:10 +0000 1996
>Last-Modified:  Thu Jul 24 18:27:31 +0000 1997
>Originator:     Erik Bertelsen
>Release:        NetBSD-current 10. jan. 1996
>Organization:
UNI-C
>Environment:
NetBSD 1.1A/Mac68k, Mac II cx.

>Description:

Enabling options DEBUG in the kernel configuration file for NetBSD/Mac68k
reveals two kinds of errors:

1. Redefinitions of DEBUG in various source files which are treated as errors
under gcc -Werror. According to the C Standard, redefinition of a macro without
#undefs between the definitions is only valid if both definitions have exactly
the same replacement texts.
In particular the #define DEBUG followed immediately by #undef DEBUG is a
unnecessary violation of this rule. It is in fact always valid to #undef
a macro regardless of the existence of a macro of this name at the current
place in the compilations.

This causes compilation errors in the files ser.c and fpu_emulate.h that can
be corrected as shown in the patches below.

locore.s cause a warning from the C preprocessor that does not cause the com-
pilation to halt, but it is still in the same class. In locore.s, DEBUG is
used to control the definition of a macro that is never used, so in the
patch below, I removed this definition as well (plus a variable that is only
used within this macro, but set in machdep.c.

2. Exposition of bugs in code that is not normally compiled into the kernel.

In nubus.c a missing type cast of the second parameter to pmap_extract is
missing.

In vm_machdep.c there is a reference to the macro CLOFFSET, but this macro
is (no longer?) defined in any header file.  Without having any replacement
code, the comment above in the source file leads me to guess that the inten-
tion is to test that size is an integral multiplum of CLSIZE. My patch to
this function is NOT a fix, just a work-around to make it compile.
>How-To-Repeat:
 Add 
    option DEBUG
 to kernel configuration file and re-compile.
>Fix:

*** arch/mac68k/dev/nubus.c	Sat Oct 14 03:07:53 1995
--- arch/mac68k/dev/nubus.c.ny	Thu Jan 11 14:10:12 1996
***************
*** 168,174 ****

  #ifdef DEBUG
  	if (nubus_debug & NDB_PROBE) {
! 		phys = pmap_extract(pmap_kernel(), rom_probe-1);
  		printf("probing slot %d, first probe at 0x%x (phys 0x%x).\n",
  			slot, rom_probe-1, phys);
  	}
--- 168,174 ----

  #ifdef DEBUG
  	if (nubus_debug & NDB_PROBE) {
! 		phys = pmap_extract(pmap_kernel(), (vm_offset_t)rom_probe-1);
  		printf("probing slot %d, first probe at 0x%x (phys 0x%x).\n",
  			slot, rom_probe-1, phys);
  	}
========================================================

*** arch/mac68k/dev/ser.c	Thu Dec 14 13:22:33 1995
--- arch/mac68k/dev/ser.c.ny	Thu Jan 11 14:13:41 1996
***************
*** 120,127 ****
  #define zsstart serstart
  #define zsstop serstop
  #define zstty sertty
- #define DEBUG
- #undef DEBUG

  #define ZSMAJOR 12              /* XXX */

--- 120,125 ----
========================================================

*** arch/mac68k/mac68k/locore.s	Mon Dec 11 21:36:33 1995
--- arch/mac68k/mac68k/locore.s.ny	Thu Jan 11 14:19:07 1996
***************
*** 804,827 ****
  	.globl _IOBase
  	.globl _NuBusBase

- 	.globl _locore_dodebugmarks
- 
- #define DEBUG
- #ifdef DEBUG
- #define debug_mark(s)			\
- 	.data	;			\
- 0:	.asciz	s ;			\
- 	.text	;			\
- 	tstl	_locore_dodebugmarks ;	\
- 	beq	1f ;			\
- 	movml	#0xC0C0, sp@- ;		\
- 	pea	0b ;			\
- 	jbsr	_printf ;		\
- 	addql	#4, sp ;		\
- 	movml	sp@+, #0x0303 ;		\
- 1:	;
- #endif
- 
  start:
  	movw	#PSL_HIGHIPL,sr		| no interrupts.  ever.

--- 804,809 ----
***************
*** 2123,2128 ****
  _mac68k_vrsrc_vec:
  	.word	0, 0, 0, 0, 0, 0
  _mac68k_buserr_addr:
- 	.long	0
- _locore_dodebugmarks:
  	.long	0
--- 2105,2108 ----
*** arch/mac68k/mac68k/machdep.c	Wed Jan 10 13:26:00 1996
--- arch/mac68k/mac68k/machdep.c.ny	Thu Jan 11 14:21:13 1996
***************
*** 1890,1896 ****
  extern void
  getenvvars()
  {
- 	extern u_long locore_dodebugmarks;
  	extern u_long bootdev, videobitdepth, videosize;
  	extern u_long end, esym;
  	extern u_long macos_boottime, MacOSROMBase;
--- 1890,1895 ----
***************
*** 1936,1942 ****
  	}
  	mac68k_machine.mach_memsize = getenv("MEMSIZE");
  	mac68k_machine.do_graybars = getenv("GRAYBARS");
- 	locore_dodebugmarks = mac68k_machine.do_graybars;
  	mac68k_machine.serial_boot_echo = getenv("SERIALECHO");
  	mac68k_machine.serial_console = getenv("SERIALCONSOLE");
  	/* Should probably check this and fail if old */
--- 1935,1940 ----
========================================================

*** arch/m68k/fpe/fpu_emulate.h	Mon Dec 11 21:35:50 1995
--- arch/m68k/fpe/fpu_emulate.h.ny	Thu Jan 11 15:23:40 1996
***************
*** 302,309 ****
  int fpu_store_ea __P((struct frame *frame, struct instruction *insn,
  		  struct insn_ea *ea, char *src));

! /* macros for debugging */
! #define	DEBUG			/* XXX */

  extern int fpu_debug_level;

--- 302,308 ----
  int fpu_store_ea __P((struct frame *frame, struct instruction *insn,
  		  struct insn_ea *ea, char *src));

! /* declarations for debugging */

  extern int fpu_debug_level;

========================================================

*** arch/mac68k/mac68k/vm_machdep.c	Mon Dec 11 21:36:56 1995
--- arch/mac68k/mac68k/vm_machdep.c.ny	Thu Jan 11 15:30:20 1996
***************
*** 239,245 ****
  	register vm_offset_t	pa;

  #ifdef DEBUG
! 	if (size & CLOFFSET)
  		panic("pagemove");
  #endif
  	while (size > 0) {
--- 239,245 ----
  	register vm_offset_t	pa;

  #ifdef DEBUG
! 	if (size /* & CLOFFSET */)
  		panic("pagemove");
  #endif
  	while (size > 0) {
========================================================
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: briggs 
State-Changed-When: Thu Jan 11 23:19:10 EST 1996 
State-Changed-Why:  
I applied the patches as given, except for the change in vm_machdep.c 
which I changed to % CLSIZE.  Thanks for the vigilance. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.