Subject: Re: Kernel startup and entry vectors
To: Tsubai Masanari <tsubai@iri.co.jp>
From: Louis Gerbarg <gerbal@cs.rpi.edu>
List: port-macppc
Date: 04/24/2001 11:16:04
On Tue, 24 Apr 2001, Tsubai Masanari wrote:

> >> 4. Does the kernel expect to be in real-mode on entry
> >
> >Blah. Haven't looked at low-level ppc stuff in too long. Does "real
> >mode" mean no memory mapping? If so, then yes.
> 
> No.  OF needs virtual-mode on PowerMac.
> So, the kernel must be in virtual-mode on startup too.

Interesting. Mac OS X comes up with all no translations enabled. The
reason was explained on the Darwin list last night (>> is me, > is Josh
de Cesare, who wrote BootX and a number of OF patches Apple distributes):

> >3) Alter BootX so that it does not quietsce passes the client interface
> >up to the kernel. This is the cleanest way, and this is what I want to
do.
> >It requires modification start.s in order to make OS X quietsce right
at
> >the beginning of the kernel.
> 
> This breaks one of the fundamental design decisions for BootX.
> 
> * BootX will quiesce Open Firmware before the kernel is called.
> 
> If the Open Firmware client interface is used by the kernel it would 
> complicate the VM situation for the kernel.  This comes to another 
> design decision.
> 
> * BootX will call there kernel with translations off so that the 
> kernel does not have to deal with translations until it is ready.
> 
> There are problems with the page table system in Open Firmware on old 
> world roms.  This is why xnu never relies on Open Firmware's VM 
> system.
> 
> >I like alternative 3, and am willing to write the code for it, but I
could
> >understand people being hesitant about change to that chunk of the
kernel.
> >It seems like thing to do if we expect other OSes to consider BootX,
since
> >it should be the kernel's decision whether to nuke the firmware
runtime,
> >not the loaders...
> 
> Given the above problems, it is not safe or any kernel to rely on 
> OF's client interface.  It may work in some cases, but it can not be 
> made reliable for a production system.
> 
> This isn't the nicest decision to be making for the OS, but it is for 
> it's own good.
> 
> #1 is certainly a hack and does not address the OF problems.
> 
> #2 is the most difficult option, but in the long run will be the most 
> reliable on Apple's systems.
> 
> #3 holds too much risk for Mac OS X and will not happen.
 
So, I am not going to get that changed. As I see it I have a couple of
options. One, I can drop the endeavor. Two, I can try to make an alternate
entry vector for the NetBSD kernel that sets up some the translation
mechanism (this will deprive the kernel of the OF CI though). I can also
attempt to make BootX detect NetBSD kernels, and alter its behaviour (do
you guys place anything special in a note section, or something like
that?). The later is probably the simplest, though it is not the cleanest.
Josh seems pretty convinced the Old World OF CI can not be used reliably
in a general manner, I would what your thoughs on the issue.

Louis