Subject: Re: A fix for the panic on reboot problem in NetBSD 3.1 (tested in SE/30)
To: Martin Husemann <martin@duskware.de>
From: Sungwon Chung <lucky.cimon@gmail.com>
List: port-mac68k
Date: 01/04/2007 00:06:17
On 1/2/07, Martin Husemann <martin@duskware.de> wrote:
> On Tue, Jan 02, 2007 at 07:05:46AM -0500, Sungwon Chung wrote:
> > The region 'everything < start' is used in bootstrapping to get some
> > information about video and memory configuration previously obtained
> > by MacOS. When the cpu_reboot() is called, doboot() in locore.s executes
> > a MacOS ROM reset subroutine for reset.  After execution is handed
> > over to the MacOS ROM reset subroutine, the MacOS ROM may
> > need to write the 'everything < start' region for interrupt vector table
> > and so on, before reinitializing the MMU.
>
> Wouldn't it be better to make that part of RAM writtable in cpu_reboot() only?
> I couldn't find any ROM calls after initial bootstrap outside of doboot(),
> but maybe I missed something. Are there interrupt vectors into the ROM?
>
> We certainly do not risk a lot by making (small) parts of kernel text writable
> when we are about to reset the machine ;-)
>
> But first of all - does the same problem happen on your machine with -current?

Of course, I think it would be safer to make that part of RAM writable
only in cpu_reboot(). But there are tiny codes using the MacOS ROM
subroutine other than doboot(). It may be the reason for the booting
failure when DDB or KGDB option is omitted before NetBSD 3, because
omitting this compile option made the whole page table entries for
kernel text as read-only. The interrupt vectors are in the 'everything
< start' region as listed in locore.s by vectors.s.

For the ROM call usage, it seems to me that, only for Quadra machine,
VIA interrupt handler calls MacOS ROM routine. Additionally, ROM based
ADB driver uses ROM subroutines although it is very uncommon in use
now.

And with -current, the same reboot on panic problem happened in my
SE/30 without the fix. This problem was already reported as NetBSD PR
#35068.

Best,
Sungwon