Subject: Re: Kernel Start-up Question
To: Ken Nakata <kenn@synap.ne.jp>
From: I-Jong Lin <ijonglin@EE.Princeton.EDU>
List: port-mac68k
Date: 08/25/1998 23:05:19
> 
> On Tue, 25 Aug 98 21:13:46 EDT, I-Jong Lin wrote:
> > 
> > The '040 definitely has its MMU off.  However, I'm unsure whether
> > the initial '030 (pre-accelerator swithch) has its MMU off.  Well, actually, 
> > I'm not too sure  -- before I asked a question to newsgroup whether logical 
> > address 0 was equal to physical address 0 when netbsd hit the start symbol.
> > And the general consensus was no, that was not true -> ergo, my belief that
> > MMU in the '030 must be off. 
> 
> The answer "no" was "in general"; i.e. it may be yes under a
> particular circumstance but you cannot generally guarantee that it is
> always "yes" under any circumstance.  IOW, that may depend on the
> machine you are talking about.  IIci and IIsi come to mind IIRC.

Hmm.  So, just limiting the discussion to my Mac IIcx, is the MMU
on or off at the start of NetBSD?


> 
> Anyway, you might want to pass some of the 030's context to the 040
> through reset vector's initial SP.
> 
> 	- Save context including MMU registers to somewhere.
> 	- Get the physical address of the saved context - you must
> 	check MMU status here.
> 	- *(void *)0 = physical address of instruction you want 040 to
> 	start.
> 	- *(void *)4 = physical address of the saved context.
> 	- Wake up 040.
> 
> When 040 starts execution, it can just pop the context from the stack.
> With this, even if 030 MMU is enabled, there's at least a way to
> reconstruct the mapping from the page table in memory because you have
> access to the Root Pointers.
> 
> Ken
> 

Oh, I do all of that stuff.  That's not the problem ...  except it's a 
little harder than what you wrote due to a couple of facts:

1. although the MMU registers in the '030 and '040 may have the same
names, they are actually different ( at least that's what the data
books on '030 and '040 tell me)

2. the pages tables of an '030 and '040 are not necessarily compatible either.
   the routines for the translation of these page tables is too much for me.

What this incompatibility tells me is that if NetBSD can boot up the CPU
when the MMU is off, the best situation for switching from '030 to '040
would be if the '030 MMU was off.  Right now, I've hijacked some code from
my apple system extensions into the NetBSD kernel to rebuild new '040
page tables when the switch occurs, but it doesn't seem to be working.
So, I'm looking for another angle here...

BTW, in the system extension source code that I have it seems that the reset 
vector is located at *(void *)4 and the initial stack is at *(void *)0.

Thanks in advance,
I-Jong