Subject: Re: A fix for the panic on reboot problem in NetBSD 3.1 (tested in SE/30)
To: Sungwon Chung <lucky.cimon@gmail.com>
From: Chuck Silvers <chuq@chuq.com>
List: port-mac68k
Date: 01/08/2007 09:24:01
On Tue, Jan 02, 2007 at 07:05:46AM -0500, Sungwon Chung wrote:
> On 1/2/07, Martin Husemann <martin@duskware.de> wrote:
> >On Tue, Jan 02, 2007 at 04:22:39AM -0500, Sungwon Chung wrote:
> >> The fix finally made is simply to change the line 362 of the
> >> 'usr/src/sys/arch/mac68k/mac68k/pmap_bootstrap.c'
> >> by adding '+ 1'.
> >
> >This looks kinda wrong to me (but I do not understand a lot of the 
> >underlying
> >magic). Why does the ROM need write access to everything < start, does it
> >realy have to be "everything" - and why don't we just align start on a page
> >boundary?
> >
> >Martin
> >
> 
> (1) I also don't know the exact reason for write acess to everything < 
> start.
> 
> What I guess is as follows.
> 
> 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.
> 
> I think its commiter is the one who can tell us the exact answer.
> The minimal write access for ROM was implemented at revision 1.62,
> which is after NetBSD 2.1:
> 
> http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/mac68k/mac68k/pmap_bootstrap.c.diff?r1=1.61&r2=1.62&f=h

hi, that would be me.  I see that in a later mail you explained why
the code just leaves these pages mapped read/write all the time.


> (2) I think we can probably align the 'start' at a page boundary by
> modifying '/usr/src/sys/arch/mac68k/mac68k/locore.s'.
> I just wished to minimize the modification.

the real problem was that the memory location that was used for the "pmove"
instruction was in the (read-only) text section.  it was the previous
instruction that stored zero into that location that was causing the trap.
the reason that your change made the problem go away was that the text
location that was mistakenly being used was in the page after "start",
ie. the page that your change made writable.

the fix is in -current now, and should be in the 4.x and 3.x branches soon.

-Chuck