move interrupt establishment to just before clock interrupts are
enabled (from the attach routine), and add comments as to why. Some PALcode apparently 'saves' a clock interrupt for the kernel, and if the clock interrupt handler is enabled at attach time, it will be run when that interrupt hits, i.e. right after the spl0() at the end of autoconfiguration. That would cause hardclock to be run, but proc0's p_stats isn't set up by then, which would cause hardclock to crash.
This commit is contained in:
parent
12fc617201
commit
fc7b72ee10
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clock.c,v 1.13 1996/10/13 02:59:25 christos Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.14 1996/11/23 06:31:57 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -70,18 +70,17 @@ clockattach(dev, fns)
|
|||
{
|
||||
|
||||
/*
|
||||
* establish the clock interrupt; it's a special case
|
||||
* Just bookkeeping.
|
||||
*/
|
||||
set_clockintr();
|
||||
#ifdef EVCNT_COUNTERS
|
||||
evcnt_attach(self, "intr", &clock_intr_evcnt);
|
||||
#endif
|
||||
printf("\n");
|
||||
|
||||
if (clockfns != NULL)
|
||||
panic("clockattach: multiple clocks");
|
||||
clockdev = dev;
|
||||
clockfns = fns;
|
||||
#ifdef EVCNT_COUNTERS
|
||||
evcnt_attach(dev, "intr", &clock_intr_evcnt);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -120,6 +119,20 @@ cpu_initclocks()
|
|||
tickfixinterval = hz >> (ftp - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Establish the clock interrupt; it's a special case.
|
||||
*
|
||||
* We establish the clock interrupt this late because if
|
||||
* we do it at clock attach time, we may have never been at
|
||||
* spl0() since taking over the system. Some versions of
|
||||
* PALcode save a clock interrupt, which would get delivered
|
||||
* when we spl0() in autoconf.c. If established the clock
|
||||
* interrupt handler earlier, that interrupt would go to
|
||||
* hardclock, which would then fall over because p->p_stats
|
||||
* isn't set at that time.
|
||||
*/
|
||||
set_clockintr();
|
||||
|
||||
/*
|
||||
* Get the clock started.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue