Subject: Re: [wrstuden@netbsd.org: CVS commit: src/sys/arch/macppc/conf]
To: Chris Tribo <ctribo@college.dtcc.edu>
From: Tim Kelly <hockey@dialectronics.com>
List: port-macppc
Date: 10/23/2004 04:25:57
On Fri, 22 Oct 2004 22:27:36 -0400 (EDT)
Chris Tribo <ctribo@college.dtcc.edu> wrote:

> Will this still require real-base and load-base to be modified on old
> world machines, or just the MacOS X default load base of 600000?

For OF 1.0.5, if the real-base setting is left to -1, OF will chose
0x400000 (4M) for loading itself, and claim 1M of address space. If the
kernel is less than 3M, the real-base setting can be left alone. Note
that this excludes GENERIC and INSTALL and requires a custom make. On
the plus side, OF 1.0.5 OW Macs don't have USB and other stuff, so it
might be possible to get the kernel that small.

If one is using GENERIC or INSTALL, the real-base setting in OF 1.0.5
Macs must be moved.

I have not determined exactly which OF version began the practice of
using the top 1M of physical RAM for loading itself. I believe I have
seen it on OF 2.4 equipped Powerbooks. To determine if your Mac needs to
have real-base moved, boot into OF and type

dev /memory .properties

and examine the "available" property. The syntax of the available
property is "address size" where address is the start point of the
region and the length is the size of the region. If it is one contiguous
region, normally starting at 0, then real-base does not need to be
moved. If it is two separate regions, real-base needs to be moved as the
location of OF is the reason for the discontinuity.

If real-base does need to be moved, use the recommended setting from
NetBSD.

Load-base is much more flexible. I've used 0x4000 with few problems, and
I've used the later setting of 0x600000. I've used 0x2000000. The
biggest restriction with load-base is that it needs to be somewhere that
the initial load of the ofwboot.xcf bootloader won't hit anything. The
loading of the bootloader is a two stage process. First OF reads the
file into memory, beginning at load-base, and then OF copies an image of
the file into memory at the linked location. If load-base is underneath
real-base close enough that the initial reading will hit OF, OF will
cause an exception. If load-base is close enough to the linked location,
the copying of the image will result in writing over part of the
original read before it's been copied into the new location. We'll call
that condition "unpredictable results can occur." Since the bootloader
is about 60k or so, generally this isn't a problem. 0x600000 is a pretty
safe area, and later OFs use 0x800000 for load-base.

This leads to the last criteria: making sure the linked location of the
bootloader is far anough away from the kernel linked location such that
loading the kernel into memory doesn't run over the bootloader.
Currently the resolution to this is to have the bootloader linked at
0xe00000. Since the kernel is linked at 0x100000, that give 13M of
address space if real-base has been moved out of the way.

I spent of lot of time examining these issues and I have several
write-ups at

http://www.dialectronics.com/OldWorldMacs/

I need to update it a bit, but hopefully it'll help anyone wanting to
learn some of the obstacles to getting an operating system working on a
computer.

tim