Subject: Re: Question about load-base
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Bill Studenmund <wrstuden@netbsd.org>
List: port-macppc
Date: 12/25/2001 14:26:56
On Sat, 22 Dec 2001, Izumi Tsutsui wrote:

> wrstuden@netbsd.org wrote:
>
> > The question is: for "partition 0" loading on OF 1 & 2, does it have to be
> > set to where the code will expect to run? Can it be set somewhere else?
> > *Must* it be set somewhere else?
>
> I guess load-base is only used to load and execute xcoff files.
> For "partition x", Openfirmware uses addresses stored
> in the Apple partition map.

Unfortunatly we've had experience where this isn't fully the case; yes,
the loader looks in the partition map for the bootxx load address, but if
load-base isn't set right, things don't work.

> macppc/stand/installboot/installboot.c:writeapplepartmap() writes
> "faked" partition map entries to set address and length where bootxx
> (i.e. primary bootloader) should be loaded:

[snip]

> The loaded bootxx will load ofwboot (i.e. secondary loader) at address
> of "entry_point", which is set by installboot.c:loadblocknums().
>
> > The essence of the question though is will the "partition 0" code need to
> > have its load address at 600000? If so, that means we need ofwboot.xcf and
> > ofwboot.elf that load not at 600000, and ofwboot that loads at 600000.
>
> The load address for ofwboot is defined in installboot.c as DEFAULT_ENTRY.
> Current DEFAULT_ENTRY value is 0x600000, but I guess it could be changed.

True we should keep DEFAULT_ENTRY in sync with where ofwboot should be
loaded. But folks have reported that if load-base isn't set right, :0
loading won't work. :-(

I bet there is some error in what bootxx is doing, and if load-base is set
right, things just work.

Take care,

Bill