Subject: kern/5131: gus driver shouldn't decide to drop into debugger.
To: None <>
From: None <nathanw@MIT.EDU>
List: netbsd-bugs
Date: 03/07/1998 18:33:37
>Number:         5131
>Category:       kern
>Synopsis:       gus driver shouldn't decide to drop into debugger.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar  7 15:35:00 1998
>Originator:     Nathan J. Williams
Massachvsetts Institvte of Technology
>Release:        <NetBSD-current source date> NetBSD-current of 98/3/7
System: NetBSD 1.3E NetBSD 1.3E (ROAD-RUNNER) #92: Sat Mar 7 00:51:36 EST 1998 i386

	The gus driver has some #ifdef DDB code to decide whether to call 
panic() or Debugger(). This is wrong; the right thing for a driver to do is 
to call panic() and let panic() decide whether to drop into the debugger, a 
decision which depends on more than just DDB being defined (the value of 
db_onpanic, for example).
	Try to figure out why your machines keep dropping into DDB when 
db_onpanic is set to 0, and grovel around the kernel sources.
	Stare at sys/dev/isa/gus.c and smack head.
	Apply this patch:

*** gus.c.orig	Sat Mar  7 18:21:43 1998
--- gus.c	Sat Mar  7 18:21:53 1998
*** 1686,1699 ****
  			    sc->sc_playbuf = ++sc->sc_playbuf % sc->sc_nbufs;
  			    gus_start_playing(sc, sc->sc_playbuf);
  			} else if (sc->sc_bufcnt < 0) {
- #ifdef DDB
- 			    printf("%s: negative bufcnt in stopped voice\n",
- 				   sc->sc_dev.dv_xname);
- 			    Debugger();
- #else
  			    panic("%s: negative bufcnt in stopped voice",
- #endif
  			} else {
  			    sc->sc_playbuf = -1; /* none are active */
--- 1686,1693 ----